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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

TOP 50 Records to show on different Tables

How to to convert below sql into  DAX show TOP 50 records based Rank wise. Here all columns comes from different tables . Please 
SELECT top 50
RANK()OVER (ORDER BY SUM(LINE Amount) DESC) AS Ranking, Fact (Table)
Network Licence Number, ( Network Table)
Provider ID (provider Table)
Provider Name (Provider Table)
SUM(LINE Amount) as Paid,  (Fact  Table)
COUNT(Claim Number) as Services, (Fact Table)
COUNT(DISTINCT(Members))as Patients-- Fact 
 
data.PNG
 
 
3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous 

New column =RANKX(all('Fact Claim'),LINE_AMT_Paid,,desc,dense)

 

New Meausre= RANKX(all('Fact Claim'),sum(LINE_AMT_Paid),,desc,dense)

Now to filter you can use a visual level filter or create a filter based measure -

Refer this, you can use a static variable instead of What if

https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415

 

Also,For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale

Anonymous
Not applicable

Hi Amit, I tried this measure but it's giving me duplicate ranks, please help me how can i get unique count.

Rankx = RANKX(ALL('Fact Claim'),[Paid Amount],,DESC,Dense)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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