
1. Re: Determine "Grand Total" when using 2 parameters and multiple calculations
Michel Caissie Jan 21, 2015 3:20 PM (in response to Todd Cummings)Todd,
What you have to understand here is that the Grand Total computes the calculated fields on all
the rows in the view without taking into account the granularity in the view.
So if we look at Exp_per_Kg_03_TF , IIF(ATTR([Type]) = "Alpha" returns null in the Total computation, because the ATTR() function returns the value of a dimension if it is unique. It's the case for every Type row, but not for the Grand Total because you don't have a unique Type.
And as soon as an operand is null in Tableau the result is null.
You can do some gymnastic to overcome this situation. See in the attached.
I replace your calculation with this one.
if MIN( [Type] ) = MAX([Type])
then
IIF(ATTR([Type]) = "Alpha",[Exp_per_KG_02_TF],[Exp_per_KG_01_parameter])
else
[Exp_per_KG_02_TF (ALPHA)] + [Exp_per_KG_01_parameter (OMEGA)]
end
if MIN( [Type] ) = MAX([Type]) returns True for the rows in the view because the granularity is at the Type level, but return false for the Grand Total row because ALPHA does not equal OMEGA. In this case we SUM each Type measure. So you will have to make copies of all your measures for each type. Hopefully you wont have to much measures in your real scenario.
I will let you do the Expense_02_New
Michel

2. Re: Determine "Grand Total" when using 2 parameters and multiple calculations
Todd Cummings Jan 22, 2015 8:59 AM (in response to Michel Caissie)Awesome  it works. Thanks!