Forum Discussion

mp390988's avatar
mp390988
Post Partisan
1 year ago
Solved

Rank function - some clarification needed

Hi,   I have a measure called BoxOffice which is simply SUM((Film[Box Office Dollars]) I want to understand why the Rank function yields different results when I write [BoxOffice] versus SUM(Film[...
  • Deku's avatar
    1 year ago

    A measure has a implict Calculate() wrapped around it causing context transition, changing the row context of the table you are iterating with rank to be convert to a filter context.

    Where as the sum by itself only has the row context from the iteration

  • mp390988's avatar
    1 year ago

    I understand a measure has an implicit Calculate wrapped around it which can cause context transition provided a table is being iterated. My question is that all iterator functions in DAX have an X at the end of it, like SUMX, AVERAGEX, RANKX ---> these are iterators but there is an exception, FILTER is also an iterator which doesn't have an "X". Does the same apply to RANK? Is the RANK function an iterator just like FILTER that doesn't have an "X" in its name?

  • Deku's avatar
    1 year ago

    RANKX is a iterator function.

    Rank is a window functions. It has to generate a data cache (a table) that has all the columns from the relation parameter you provide. For each row in that table it will apply your orderby. If the orderby is a expression then it will have to be evaluated similar to a x function