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.
Hi,
I hope you can assist me,
I need to show in a visualization top 5 companies with the biggest ebit , I use the top N filter, But even when the company I work for is not in the TOP 5 I need it to appear so that it will show my company and the TOP 4, what is the way to do that?
Thank you,
Solved! Go to Solution.
RANK =
VAR __rnk = RANKX( ALLSELECTED( EBIT[Company] ), [Total] )
RETURN
IF(
MAX( EBIT[Company] ) = "My Company"
|| __rnk <= MAX( 'TOP'[Value] ),
__rnk
)
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
RANK =
VAR __rnk = RANKX( ALLSELECTED( EBIT[Company] ), [Total] )
RETURN
IF(
MAX( EBIT[Company] ) = "My Company"
|| __rnk <= MAX( 'TOP'[Value] ),
__rnk
)
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@Anonymous
You can write a measure that calcualtes the [EBIT] for the top 5 and your company and filters the results to that list of companies.
Here is an example using a [Sales Amount] measure but the pattern would be the same, just need to change the names to match your model.
Top 5 + my company =
VAR _TOPN = TOPN(5,ALL('Customer'[Company]),[Sales Amount])
VAR _MyCompany = FILTER(VALUES('Customer'[Company]),'Customer'[Company] = "AlbanyCompany")
VAR _List = UNION(_TOPN,_MyCompany)
RETURN
CALCULATE(
[Sales Amount],
KEEPFILTERS(_List)
)
You can see the measure returns the top 5 plus the company I have marked as _MyCompany even though their amount is lower then others:
This will show 6 if your company is not in the top 5 or only 5 if your company is in the top 5.
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 | |
96 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
88 | |
63 |