Forum Discussion

rishikhurana's avatar
rishikhurana
Regular Visitor
4 years ago
Solved

Dynamic x axis numbering based on filtering

Hi Everyone,

 

I am very new to the Power Bi (literally 4 day old). I need to make two graphs which are based on 7-8 filters/slicers. Current selection shows you 8 filtered clients. Graph to the left is fine and I want to keep it that way with client names however, graph to the right I want to disguise the client name and name them

Peer1, Peer2, Peer3 so on till Peer8 in this case.

 

However, the best I could do is to use Rankx formula below in a new measure and use this to create column using concatenate(Peer&Ranking). But as can be seen in the image, the rank is given to all the 43 rows and doesnt dynamically change with chosen filters. 

 
Ranking =
RANKX(ALLSELECTED('Program Level Data'),
'Program Level Data'[Key],
MAX('Program Level Data'[Key])
)

 

I am pretty sure there is a way to do this job and I can see number of peers based on number of selected data (8 in above scenario), please help.

 

Also, next step would be to make a toggle switch and keep just one graph, and switch between these two views within a graph.

#rankx #slicer #filter #powerbi #dataquery #graph #dynamic

 

Please support. Thanks in advance.

Rishi

 

 

4 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Icon for Community Champion rankCommunity Champion

    Calculated columns are not dynamic. They are calculated when the model is loaded. If you want the top 8, there  is an option in the filter pane for the visual. In the filter pane, for the Peer column choose TopN from the deopdown, type in 8 and add the measure you have in the visual for the TopN calculation ("Based on" I think it's called in the filter options -I'm not in front of a pc now so can't check the exact expression)

    • rishikhurana's avatar
      rishikhurana
      Regular Visitor

      Thank you Paul for your reply. However, I dont need TopN here, what i need is to name the bars as 1,2,3, so on. based on the selections made. Just need to hide the names ABC, DEF, GHI etc, basically if presenting this dashboard to the client ABC, we dont have to identify DEF, GHI etc but just as other normal peers. Hope it clarifies. Thanks!

  • PaulDBrown's avatar
    PaulDBrown
    Icon for Community Champion rankCommunity Champion

    What slicers are you using? How many "Peers" do you need? Is there a particular reason why the axis has to be 1, 2, 3, 4.... and not 2,6,8,10....?