Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
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.
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
User | Count |
---|---|
9 | |
2 | |
2 | |
2 | |
2 |