Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi all,
I have a bar chart visual with multiple categories (e.g. customer names) on the Y axis and Revenue generated from each customer on the X axis. These customers are ranked based on the Revenue generated from them
I also have a customer slicer on this tab - so when one customer is selected on this slicer, the bar chart shows a comparison of this customer with the other customers.
I would like to be able to only show a few bars depending on the customer selected.
e.g.
if customer selected has a rank of 10, then in the bar graph only show me customers who are ranked from 1 - 15 OR if the customer selected has a rank of 11, then the bar graph should only show me customers who are ranked from 1 - 16.
I'm doing this to reduce the overcrowded bar graph because I am dealing with about 30 customers and I don't want them to all appear in my categories
Solved! Go to Solution.
Hi @Nyakwezi ,
first please create a new table for the slicer:
And then please create 2 measures like:
Ranking = RANKX(ALL('Table'[Customer ID]),[Total Profit],,DESC,Dense)
ViusalsFilter =
VAR _select_id = SELECTEDVALUE('DimCustomer'[Customer ID])
VAR _select_rank = IF( NOT ISBLANK(_select_id), CALCULATE([Ranking],'Table'[Customer ID]=_select_id))
VAR _max_rank = _select_rank+5
VAR _filter =
IF(ISBLANK(_select_id),1,IF([Ranking]<=_max_rank,1))
RETURN
_filter
Apply the 2nd measure to the bar charts filter:
And the output:
Please check the pbix file.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi @Nyakwezi ,
first please create a new table for the slicer:
And then please create 2 measures like:
Ranking = RANKX(ALL('Table'[Customer ID]),[Total Profit],,DESC,Dense)
ViusalsFilter =
VAR _select_id = SELECTEDVALUE('DimCustomer'[Customer ID])
VAR _select_rank = IF( NOT ISBLANK(_select_id), CALCULATE([Ranking],'Table'[Customer ID]=_select_id))
VAR _max_rank = _select_rank+5
VAR _filter =
IF(ISBLANK(_select_id),1,IF([Ranking]<=_max_rank,1))
RETURN
_filter
Apply the 2nd measure to the bar charts filter:
And the output:
Please check the pbix file.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Oh my word.
Thank you so much.
I've been at this for a couple of months. It worked perfectly