Forum Discussion
Row and Filter contexts
- 3 years ago
Hi daanodinot ,
According to your description, I created a sample. Measure 2 is using ALL function.
When using RANKX function without ALL function, the following steps will be performed.
RANKX(<table>, <expression>[, <value>[, <order>[, <ties>]]])
Step1: Calculate the query context.
Step2: The RANKX function creates an iteration context in Table Score.
Step3: Compute expression, perform a context transformation, change to a filtering context again, and generate a data series of ranking.
Step4: Calculate the value in the query context.
Step5: Calculate the rank of value in the data series in the query context.
Note that in Step 5, the query context, in addition to being used to calculate the value, but also for filtering the data series, so that all ranking results are 1.
But when you use ALL function, it will only clear the filter of data columns when calculating the rank of value and does not affect the expression time and value calculation. Therefore, you can get the correct result.
Best Regards,
Community Support Team _ xiaosunIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
"Since RANKX works in a row context, I was expecting it not to be affected by any filters". That is not the case. Iterators like RANKX work on all the rows of a table which are visible in the current filter context. Any rows which are excluded by filters are not included in the calculations.