
1. Re: Aggregate Calculations  LOD Expression  Win Rate Analysis
Stephen Rizzo Nov 21, 2018 8:01 AM (in response to Renata Feher)1 of 1 people found this helpfulThis should be solvable using an INCLUDE LOD expression. Try changing [Won] to
{INCLUDE [Stage] : if MIN([Stage]) = 'Won' then sum([Total Sales]) else 0 end}
And [Win Rate] to
MAX([Won]) / sum([Total Sales])
You will have to replace the AGG([Won]) pills with either SUM([Won]) or MAX([Won]), but once those changes are made it should work as expected.

2. Re: Aggregate Calculations  LOD Expression  Win Rate Analysis
Renata Feher Nov 21, 2018 9:37 AM (in response to Stephen Rizzo)Hi Stephen,
Thanks for the quick solution  it works!
I have tried similar formula before but instead of MIN I have used ATTR  which of course, wasn't working.
Do you think you can share an explanation why MIN has to be used here and why does that work?
thanks again!

3. Re: Aggregate Calculations  LOD Expression  Win Rate Analysis
Stephen Rizzo Nov 21, 2018 9:55 AM (in response to Renata Feher)Sure. The short answer is that LOD expressions aren't allowed to include the ATTR function. Because we're forcing the calculation to include [Stage] in the level of detail, we know that [Stage] will be constant for all rows being aggregated. So ATTR([Stage]) and MIN([Stage]) are both guaranteed to return the same value.
I am sure there is a technical reason behind Tableau's decision, but I don't know what that is. You can replicate the ATTR function logic in the LOD expression just fine using IF MIN([Stage])=MAX([Stage]) THEN MIN([Stage]) ELSE "*" END.

4. Re: Aggregate Calculations  LOD Expression  Win Rate Analysis
Renata Feher Nov 21, 2018 9:58 AM (in response to Stephen Rizzo)I think we can live with that makes sense now. Thanks again!