
1. Re: Tableau Calculation
Manideep Bhattacharyya Apr 10, 2016 7:00 PM (in response to Nagaraj Koranthota)Hello  I have modified your data source a litte bit. Replaced Null with Nul to fool Tableau. Then done the following steps:
1. Created a calculated field "Max Amount Per order" and the expression is {FIXED [Order]: max([Amount])}
2. Created another calculated field "Category " and the expression is if [Amount] = [Max Amount per Order] then [Category] END
3. Created another calculated field "Max Total Value per Order" and the expression is {FIXED [Order]: max([Total Sum])}
4. Exposed the Calculated field "Category " as ATTR
5. Add the Category as the context filter to include and exclude Nulls.
Hope this solve your issue.
Thanks,
Manideep

Solution.twbx 4.7 KB


2. Re: Tableau Calculation
Nagaraj Koranthota Apr 10, 2016 7:20 PM (in response to Manideep Bhattacharyya)Hi Manideep,
Appreciate your response.
I also want to see the third order 7772 with Null(Nul) and show corresponding amount.
If I add to the filter the calculations goes wrong.
I have other filters which will be applied to this data , If I use FIXED LOD will it cause any issue as FIXED happens before filter ?
Regards,
Nagaraj

3. Re: Tableau Calculation
Manideep Bhattacharyya Apr 10, 2016 7:40 PM (in response to Nagaraj Koranthota) 
4. Re: Tableau Calculation
Nagaraj Koranthota Apr 10, 2016 7:56 PM (in response to Manideep Bhattacharyya)Hi Manideep,
The above results aren't correct .
I have mentioned what is the expected output.
1231 should show b as its category not null , even if Nul is having the highest but there is non nul value in the order 1231 which I want to see.
Regards,
Nagaraj

5. Re: Tableau Calculation
Manideep Bhattacharyya Apr 10, 2016 7:59 PM (in response to Nagaraj Koranthota)Hello  You should have uniform logic. If you include null then for the Order "1231" Nul should return, because Nul Category has the highest Amount (9) for that Order Id.
Thanks,
Manideep

6. Re: Tableau Calculation
Nagaraj Koranthota Apr 10, 2016 8:08 PM (in response to Manideep Bhattacharyya)That's why I explained clearly what I am expecting as an output from the data provided.

7. Re: Tableau Calculation
Manideep Bhattacharyya Apr 10, 2016 11:30 PM (in response to Nagaraj Koranthota)Hello  As you have mentioned that the logic is "
 To find a category which has max amount for a given Order and show the total amount for that order."
So is there a specific logic for that specific Order Id. Please let me know.
Thanks,
Manideep

8. Re: Tableau Calculation
Mahfooj Khan Apr 11, 2016 12:10 AM (in response to Nagaraj Koranthota)Try this
attached 9.2

Result.twbx 10.7 KB
