Klass this is a very good question
the way LOD expressions work is they look at all the dimensions before the colon : and create permutations based on those combinations - in you last order expression that is just Customer - so for each customer the expression determines the last order date (Max ) (the first expression
I can't explain what is happening with your second statement - I assume that the second dimension is the last order date you calculated in the first step and when I include it in an LOD expression - like you - I get a sum of all sales -
But you can use your first expression in either IF statements or as a filter
in an if statement if [Order Date]=[fixed last order date] then [Sales] else 0 end
Will result in this - the first column is all sales - the second is only last date sales
As a binary Filter [Order Date]=[fixed last order date] (set to true )
Results in this
and with either you can get the lower level detail
Let me know if this helped
If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution. Thank you.
Another way to get the result you are looking is to nest LOD expression and IF ELSE statement, to tell Tableau for each Customer find the maximum order date, then sum the sales for that day.
Something like this
To double check the result in Tableau, notice that for each customer you will have one Last Sales value.
Removing, Order ID and Order date
Attached .twbx file for reference
Let me know if this helps!
Book1.twbx 7.5 MB