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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Learner_SG
Helper IV
Helper IV

RANKX not working

Hi All,

Could anyone help on this error. My RankX function is not working as expected. I need to select the top4 of the last 7th and 6th day data. These are the steps that  I have done.

A measure was created to select all the data of the last 6th and 7th day. After that the rank measure was created and filtered the rank <=4. But some where it is going wrong ,because all the rank seems to be 1. how should I modify it. Could help?

Learner_SG_0-1647825607875.png

Learner_SG_1-1647825643715.png

Learner_SG_2-1647825729945.png

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Learner_SG , In Rankx you should columns, that will be present in visual or you should use table having both

Rankx( All(Table[Time], Table[WeekDay]), [Measure],,desc,dense)

 

Measure should have calculation and filter

 

measure = calculate(sum(Table[Value]), filter(Table, Table[Date]>= Today() -6 && Table[Date]<=Today() ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
Learner_SG
Helper IV
Helper IV

@amitchandak ,it seems to work now. thanks a lot.

amitchandak
Super User
Super User

@Learner_SG , In Rankx you should columns, that will be present in visual or you should use table having both

Rankx( All(Table[Time], Table[WeekDay]), [Measure],,desc,dense)

 

Measure should have calculation and filter

 

measure = calculate(sum(Table[Value]), filter(Table, Table[Date]>= Today() -6 && Table[Date]<=Today() ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak I have another issue which I face now. As I had mentioned earlier , I need to get the 4 higest of the 7th and 6th day which I am able to get. But the 6th day data displayed today and  tmw(tmw -then it becomes the 7th day) the time changes because the 4 highest data collected changes. How can I make it the same ? Pls ref to the below pictures.

Learner_SG_1-1648019670505.jpeg

 

Learner_SG_0-1648019631593.png

If you see the wednesday data , it is different in the two tables. So how do I select individually for each day and combine so that It does not change?

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.