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 Experts,
I have the following table :
I need to show top 3 countries with their revenue corresponding to the Product No. e.g.
Can you please suggest ,how I can acheive this.
Thanks and Regards,
Tushar Gaurav
Solved! Go to Solution.
Hi @TusharGaurav To achieve your expected output please create Two measures as below, I have used ALLSELECTED to make the Ranking Dynamic based on filter selection.
Total Revenue = MAX('Table'[Revenue]) --Replace MAX with SUM for total revenue
Top 3 Country Revenue =
var _rnk = RANKX(
ALLSELECTED('Table'[Country]),
[Total Revenue],
,
DESC,
DENSE
)
RETURN
IF(
HASONEVALUE('Table'[Country]),
IF(_rnk <= 3, [Total Revenue]))
Input:
Output:
Hope it Helps 🙂 Appreciate a Kudos !
Thanks,
Proud to be a Super User! | |
Hi @TusharGaurav
Can you please try the below DAX.(Create calculated table for this)
Hi @TusharGaurav
Can you please try the below DAX.(Create calculated table for this)
Thanks a lot for your help and prompt response
Hi Akash,
Thanks for your response.
However here I am not the total revenue corresponding to the country.
Here I need to show the revenue corresponding to the top product for a country, for example the total revenue for Country "C1" is 3215 but I need to show revenue corresponding to top product for this country i.e. 1110.
Thanks and Regards,
Tushar Gaurav
Hi @TusharGaurav To achieve your expected output please create Two measures as below, I have used ALLSELECTED to make the Ranking Dynamic based on filter selection.
Total Revenue = MAX('Table'[Revenue]) --Replace MAX with SUM for total revenue
Top 3 Country Revenue =
var _rnk = RANKX(
ALLSELECTED('Table'[Country]),
[Total Revenue],
,
DESC,
DENSE
)
RETURN
IF(
HASONEVALUE('Table'[Country]),
IF(_rnk <= 3, [Total Revenue]))
Input:
Output:
Hope it Helps 🙂 Appreciate a Kudos !
Thanks,
Proud to be a Super User! | |
Thanks for the prompt response.
This is what I was looking for.
Hi @TusharGaurav Create a measure to calculate total revenue
Total Revenue = SUM(TableName[Revenue])
Then, create a ranking measure to rank countries.
Rank by Revenue = RANKX(ALL(TableName[Country]), [Total Revenue], , DESC)
Add a table visual displaying Country and Total Revenue and filter it to show Rank by Revenue <= 3.
User | Count |
---|---|
84 | |
82 | |
66 | |
52 | |
46 |
User | Count |
---|---|
100 | |
48 | |
42 | |
39 | |
38 |