Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
mp390988
Helper IV
Helper IV

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[Box Office Dollars]) as you can see in results below. My understanding is that for context transition to take place, we need an iterator and a measure inside the iterator. Rank is not an iterator so there is no row context.

 

mp390988_1-1742249133683.png

 

 

mp390988_2-1742249248449.png

 

 

3 ACCEPTED SOLUTIONS
Deku
Super User
Super User

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


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

mp390988
Helper IV
Helper IV

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?

View solution in original post

Deku
Super User
Super User

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 


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

6 REPLIES 6
Deku
Super User
Super User

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 


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
mp390988
Helper IV
Helper IV

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?

Hi @mp390988,

 

We haven’t heard back from you regarding your issue. If it has been resolved, please mark the helpful response as the solution and give a ‘Kudos’ to assist others. If you still need support, let us know.

 

Thank you.

Hi @mp390988,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Hi @mp390988,
I wanted to check if you had the opportunity to review the information provided by @Deku. Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

Deku
Super User
Super User

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


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.