cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper V
Helper V

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
Super User IV
Super User IV

@Narayana3635 

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/3...

 

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

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)

@Narayana3635 , refer this

https://databear.com/how-to-use-the-dax-rankx-function-in-power-bi/

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors