
Hi guys,
I have been battling on how to do this for a while now.
I have a dataset which shows transactions listed by date, with transaction ID and Transaction Value. I want to perform a simple calculation that is for example:
Transaction Fee = Transaction Value + 10
However, after the n-th transaction within the month, I need to automatically change this calculation to be the following:
Transaction Fee = Transaction Value + 5
How can I do this? I figure that it is some way with index and IF statements, but I cannot figure out the index part in Tableau.
Thanks for any help!
PS: I cannot publish a sample workbook since the data I'm working with is private.
@Rafa Braga
Hi, My error, you can use then:
Total Transaction Cost:
{FIXED [Customer ID],DATETRUNC("month",[Transaction Date]): SUM([Transaction Value]) +
IF COUNTD([Transaction ID])<=[Threshold]
THEN COUNTD([Transaction ID])*10
ELSEIF COUNTD([Transaction ID])>[Threshold] THEN
10*[Threshold] + (COUNTD([Transaction ID])-[Threshold])*5
END
}
If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.
Regards,
Diego Martinez
Tableau Visionary and Forums Ambassador