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

RANKX based on a measure across two tables

Hi guys,

 

i need to create a rankx measure to get the top 10 values

i have two different tables:

 

Capturar.JPG

 

There's a measure in each table:

 

table a:

totalA = DISTINCTCOUNT(tablea[EPPARNR])

 

table b: 

totalB =
CALCULATE(
DISTINCTCOUNT(tableb[EPPARNR]);
FILTER(tableB;
AND(tableb[DAYS_BETWEEN] >=0;
tableb[DAYS_BETWEEN] <= 30)))

 

then, i created a measure to get the percentage:

 

% RV = divide(totalB; totalA)

 

now, i need to get the top 10 result. It's more than 5mi rows each table, i tried to use the % measure in a bar chart but took too long to respond 😞

 

i also tried some measures like rankx + all + calculate, but didn't work.

 

Thanks a lot!

4 REPLIES 4
v-xicai
Community Support
Community Support

Hi  @Anonymous  ,

 

Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

 

Best regards

Amy

Anonymous
Not applicable

Hi @v-xicai,

 

unfortunelly, it couldn't help.

Actually, that's exacly the result that i need, but with a better performance. When i tried "Top N", it took several minutes to work.

Is a big dataset and i need to use a measure in the data field. I think is the reason to a bad performance.

v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may go to Filter Pane, choose option Top N.  At that point, you may just drag in the measure [% RV] you want the Top N to run.

TopN.png

 

 

 

 

 

 

 

 

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

parry2k
Super User
Super User

@Anonymous first this measure need change

 

table b: 

totalB =
CALCULATE(
DISTINCTCOUNT(tableb[EPPARNR]);

tableb[DAYS_BETWEEN] >=0;
tableb[DAYS_BETWEEN] <= 30)

 

read this for ranking

 

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-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.