Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I have customer, city, sales data in 3 separate tables - relationship as per attached file.
I want to write a DAX that can identify the Top city per customer based on the sales amount.
Can someone help me? I wrote a DAX to rank the city but not able to write another DAX to identify top city.
Example:
Customer Name | City | Sales | Top City |
A | Singapore | $10,250,257 | Singapore |
B | Paris | $4,335,949 | Paris |
B | Tokyo | $3,691,496 | Paris |
B | New York | $ 705,351 | Paris |
Thanks for your help.
Pbix: https://drive.google.com/file/d/15mNrBRl809vWkiiUxnox35Umb6XinouE/view?usp=drive_link
Hi, @irenelitw629
You cam refer to @amitchandak reply. If it doesn't meet your needs, will you be able to re-share your PBIX file (Due to the Privacy Policy, please set do not require an account login to download the file.)
Best Regards,
Yang
Community Support Team
@irenelitw629 , Try index function
calculate(sum(sales[Sales]), keepfilters(index(1, Summarize(allselected(sales), City[City], Customer[Customer Name]), orderBy(City[City], desc) ,partitionBy(Customer[Customer Name]))))
Continue to explore Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U
User | Count |
---|---|
84 | |
78 | |
70 | |
47 | |
41 |
User | Count |
---|---|
108 | |
53 | |
50 | |
40 | |
40 |