Forum Discussion
Rankx Quirks
- 4 years ago
Hi User5231
I think it is the context transition. Context transition does not apply to variables as they are evaluated once. This is why rank2 does not work.
I agreed with you on rank5 but if you think about it when refering[Sum by Category Filter Method]it is actually translated to
CALCULATE ( CALCULATE ( SUM ( 'Table'[Time] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Sub Category] = MAX ( 'Table'[Sub Category] ) ) ) )As the engine wraps any measure referenced in any kind of calculation with CALCULATE.
Just a thought. you may try and confirm.
Hi User5231
I think it is the context transition. Context transition does not apply to variables as they are evaluated once. This is why rank2 does not work.
I agreed with you on rank5 but if you think about it when refering
[Sum by Category Filter Method]it is actually translated to
CALCULATE (
CALCULATE (
SUM ( 'Table'[Time] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Sub Category] = MAX ( 'Table'[Sub Category] )
)
)
)As the engine wraps any measure referenced in any kind of calculation with CALCULATE.
Just a thought. you may try and confirm.
Thanks! I think you explained it well enough... and sure enough wrapping that expression for Rank5 in a calculate does indeed make it work. That is interesting though that the Allexcept version does not need that. Any ideas on why that is the case?