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.
Hey guys,
Hey, guys, I'm not really getting anywhere right now.
I'm trying to create a measure that will give me the top 25 clients' revenue.
Then I want a second measure that gives me the sales of the bottom 25 customers.
At the end I want to calculate the difference:
Sales >Bottom25 <Top25 = [Total sales] - [sales top 25 customers] - [sales bottom 25 customers]
Thanks! all the best, herbert
Solved! Go to Solution.
@herbemischung , refer if these can help, Change column and measure as per need
TopN Customer =
VAR SelectedTop = 25
RETURN
SWITCH(TRUE(),
SelectedTop = 0, [Sales Amount],
RANKX (
ALLSELECTED( 'Customer'[Customer] ),
[Total Revenue], , desc,dense
)
<= SelectedTop,
[Sales Amount]
)
Bottom N Customer =
VAR SelectedTop = 25
RETURN
SWITCH(TRUE(),
SelectedTop = 0, [Sales Amount],
RANKX (
ALLSELECTED( 'Customer'[Customer] ),
[Total Revenue], , asc,dense
)
<= SelectedTop,
[Sales Amount]
)
@herbemischung , refer if these can help, Change column and measure as per need
TopN Customer =
VAR SelectedTop = 25
RETURN
SWITCH(TRUE(),
SelectedTop = 0, [Sales Amount],
RANKX (
ALLSELECTED( 'Customer'[Customer] ),
[Total Revenue], , desc,dense
)
<= SelectedTop,
[Sales Amount]
)
Bottom N Customer =
VAR SelectedTop = 25
RETURN
SWITCH(TRUE(),
SelectedTop = 0, [Sales Amount],
RANKX (
ALLSELECTED( 'Customer'[Customer] ),
[Total Revenue], , asc,dense
)
<= SelectedTop,
[Sales Amount]
)
@herbemischung , You can get using TOP N or Rank
For Rank Refer these links
https://www.tutorialgateway.org/power-bi-top-10-filters/
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...
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
HI @herbemischung ,
Create a measure
Total Revenue = SUM(Table[Revenue])
Top25 = CALCULATE([Total Revenue],TOPN(25,'Table',[Total Revenue],DESC)
Bottom25 = CALCULATE([Total Revenue],TOPN(25,'Table',[Total Revenue],ASC)
RETURN
Revenue - Top25 - Bottom25
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Top25 = CALCULATE([Total Revenue],TOPN(25,'CustomerTable',[Total Revenue],DESC)
Bottom25 = CALCULATE([Total Revenue],TOPN(25,'CutomerTable',[Total Revenue],ASC)
RETURN
Revenue - Top25 - Bottom25
Regards,
HN
Hi, and thank you, but unfortunately it didn't work
I only get the total revenue, I guess because in your formula is no reference to the customer.
Please share your sample pbix file to help you better.
Table should be customer table.
Regards,
HN
Sorry, but I cannot share our company data. Thanks for trying!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |