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.
User | Count |
---|---|
10 | |
5 | |
3 | |
2 | |
2 |