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 All,
So I am creating a clustered bar chart which shows the Sales by TOP N companies. Users can select N (5,10,15 etc) depending on the number of companies they want to see.
For that i am using the DAX expression:
Solved! Go to Solution.
Hi @Ritvik777
I think you can try TopN function in cluster bar visual directly.
Result is as below.
If you want to achieve your goal by measure, try this code.
TopNSales =
VAR _SelectedV =
SELECTEDVALUE ( 'Top N'[Value] )
VAR _RANK =
RANKX ( ALLSELECTED ( 'Sample'[Company] ), [M_Sales] )
RETURN
IF (
ISFILTERED ( 'Top N'[Value] ),
IF ( _RANK <= _SelectedV, [M_Sales], BLANK () ),
[M_Sales]
)
By default it will show all values.
Select 5 in slicer, result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Ritvik777
I think you can try TopN function in cluster bar visual directly.
Result is as below.
If you want to achieve your goal by measure, try this code.
TopNSales =
VAR _SelectedV =
SELECTEDVALUE ( 'Top N'[Value] )
VAR _RANK =
RANKX ( ALLSELECTED ( 'Sample'[Company] ), [M_Sales] )
RETURN
IF (
ISFILTERED ( 'Top N'[Value] ),
IF ( _RANK <= _SelectedV, [M_Sales], BLANK () ),
[M_Sales]
)
By default it will show all values.
Select 5 in slicer, result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
13 | |
2 | |
2 | |
1 | |
1 |