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
Marielle_P
New Member

Rankx top 20 results for prior 3 months

Hi all,

 

I need to create an overview of the top 20 for claims incurred for claims opened in the last 3 calendar months.

 

I created the following DAX:

 

Top 20 Claim incurred = 

VAR ClaimRank = RankX(All(Claim), [Claim incurred], , DESC

VAR Enddate = EOMonth(Today(),-1

VAR Startdate = EDate(EOMonth(Today(),-1),-3)+1

Return

IF(ClaimRank<=20 [Claim incurred] , if(MAX(Claim[Opened date])>=Startdate && MAX (Claim[Opened date])<= Enddate), [Claim incurred], BLANK ()))

 

But the report is not showing the correct results and I also can't add any data of other tables to the report (i.e. "client" which is is another table.

 

Are you able to support me? Thanks

 

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Marielle_P , Create a measure like

Rolling 3 = CALCULATE([Claim incurred],DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-1),-3,MONTH))

///or 
Rolling 3 = CALCULATE([Claim incurred],DATESINPERIOD('Date'[Date ],eomonth(today(),-1),-3,MONTH))

 

then try rank on it, you can use the visual level filter

You can also use topN, refer to my video for that - https://www.youtube.com/watch?v=QIVEFp-QiOk

Rank = RankX(All(Claim), [Rolling 3], , DESC)

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

1 REPLY 1
amitchandak
Super User
Super User

@Marielle_P , Create a measure like

Rolling 3 = CALCULATE([Claim incurred],DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date ]),-1),-3,MONTH))

///or 
Rolling 3 = CALCULATE([Claim incurred],DATESINPERIOD('Date'[Date ],eomonth(today(),-1),-3,MONTH))

 

then try rank on it, you can use the visual level filter

You can also use topN, refer to my video for that - https://www.youtube.com/watch?v=QIVEFp-QiOk

Rank = RankX(All(Claim), [Rolling 3], , DESC)

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

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.