Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
BInewbie
Frequent Visitor

Create dynamic X asix

Hi All,

 

I am trying to create a dynamic X axis where by the user should be able to select the variable they want to see on the X axis, with the Y axis fixed to Sales, e.g. Sales by Country, Sales by Person, Sales by Store etc.

 

The data is all contained in the same table.

 

I understand I can do this through a 'no dax' method by unpivoting the table for all my chosen vairables, however given my data has 10m+ rows, i dont think this will be feasible.

 

Any advice would be greatly appreciated.

11 REPLIES 11
Anonymous
Not applicable

Hey @BInewbie

 

Give this a try. It will allow you to change your X-Axis via a slicer selection, meanwhile you can put whatever you want in the Y-Axis.

 

https://www.youtube.com/watch?v=lFd2hjkKz_Q

 

Hope this helps,

Parker

mim
Advocate V
Advocate V

did ou tried bookmarks ?

BInewbie
Frequent Visitor

Yes this is a possible work around, however if I have 10 dimensions, I require 10 buttons which will take up a lot of space. Having these in a slicer would be more ideal.
Anonymous
Not applicable

@BInewbie

 

I think what you want to do is create dynamic measures 

 

sales by store

sales by dimen 2

sales by dimen 3

sales by dimen 6

sales by dimen 4

sales by dimen 5

 

use the below video to do it, https://www.youtube.com/watch?v=gYbGNeYD4OY.

 

if you need more clarification after watching the video, please lemme know where you are getting stuck and also post your power bi file 

@myayar, not quite as this is adjusting the fact used on the Y axis which is a measure. I want to be able to dynamically change the dimension in the x axis which is categorical, and hence is not a measure.
Anonymous
Not applicable

@BInewbie you use the same logic for x axis as well.

 

switch(true(),

selected value from slicer = sales by store, [Store],

selected value from slicer = sales by dimension 2, [Dimension2],

selected value from slicer = sales by city, [City],

....

)

 

@Anonymous

 

When im using the switch funciton, it is only allowing me to select measures rather than fields. Any advice?

Similarly in the video, only measures are used.

 

Anonymous
Not applicable

 @BInewbie yeah i just realized that, this actually works in tableau lol, that is why i assumed here as well, my bad.

 

here is another option https://community.powerbi.com/t5/Desktop/Dynamic-change-in-X-Axis/td-p/86167

v-lili6-msft
Community Support
Community Support

Hi@ BInewbie

You may try to use Drill mode in a visualization in Power BI

Step 1:

Drag Country , Person , Store into Axis together and sales into Value.

Step 2:

Use Drill mode

Result:

8.png9.png10.png

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you, however I should have been more clear - I’m looking for a user to be able to select there chosen dimension through a slicer.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.