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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Help with RANKX

Hello, 

 

I am looking to rank items based off of their TOTAL page views in my data set. A simple example of what the dataset looks like:

 

Item CodeDate

Page Views

123November 2022

100

123October 2022

200

456October 2022

50

 

The problem I am having is that the DAX expression I tried using:
Rank = rankx('Data','Data'[Page Views],,DESC) 
returns a ranking of each row of page views entries. What I want would look something like this:

Item CodeDatePage ViewsRank
123November 20221001
123October 20222001
456October 2022502

 

 

Any help would be much appreciated! To take things a step further, it would be great to create a dynamic ranking based upon filter selections like Date, Product Category, Etc. 

2 REPLIES 2
Anonymous
Not applicable

This did not seem to work for me as several SKUs produced a ranking of 1 despite having different totals of pageviews.

Anonymous
Not applicable

Hi  @Anonymous ,

Here are the steps you can follow:

Measure:

Rank_Meausure =
RANKX(FILTER(ALL('Table'),[Date]=MAX('Table'[Date])),CALCULATE(SUM([Page Views])),,DESC)

Calculated column:

Rank_Column =
RANKX(FILTER(ALL('Table'),[Date]=EARLIER('Table'[Date])),[Page Views],,DESC)

Result:

vyangliumsft_0-1669944515487.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors