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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Ali_HYYS
Regular Visitor

Top N value with multiple Columns from different tables.

Hi All,

I am starting a dashboard in Power BI in in which i have a requirement of a report with a Top N Customer with Complain number and some other columns from other tables.i have done with a single column but how to do it with other please guide.


var Rankin_fdim =values('Details(Prod)'[Name])
var ranking_select = [v_Ranking_Select]
return
CALCULATE( [Premium],
FILTER(Rankin_fdim,
RANKX(ALL('Details(Prod)'[Name]),[Premium],,desc)<=ranking_select)
)
 

 @amitchandak 

5 REPLIES 5
amitchandak
Super User
Super User

@Ali_HYYS , Can you share sample data and sample output in table format? I do not see multiple columns used.

 

For Rank Refer these links

https://www.sqlbi.com/articles/filtering-the-top-3-products-for-each-category-in-power-bi/
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
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Current:

Customer Name Premium
AGN 2343
ERP 3455
ERT 76575
WER 45633

Expected:
 Region and Branch against customer coming from other tables.

Customer Name  Premium  Region   Branch
AGN                    2343       Swiss          AA
ERP                     3455      Newzeland  BB
ERT                    76575    Poertland     CC
WER                  45633      Swiss           DD

Hi @Ali_HYYS,

AFAIK, current power bi does not support creating dynamic calculated column/tables based on filter/slicer. They are work on different data levels and not able to re-calculated/interact with filter/slicer selections on data view.

If you mean to get static top values based on current categories from other tables, it is possible. You can add a variable table into the calculated column to lookup correspond records, then you can apply filters on this variable table to get the specific record as a result display on your calculated column.

Please provide some dummy data if you still confused about the coding formula.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@Ali_HYYS , how about merge in power query

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Greg_Deckler
Super User
Super User

@Ali_HYYS - Difficult to say, this may help: https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452

 

Otherwise, Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.