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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
eliasayyy
Memorable Member
Memorable Member

Dynamic X-axis on Column Chart based on selection

hello everyone i have 2 tables

product analysis and campaign analysis

i made a field parameter table including the measures from both product and campaign 

some measures from product : "Adds to Cart " , "Checkouts" , "Revenues" 

some measures from Campaign : "Bounces" , "Sessions"...

i added a slicer that will allow the user to select the measure they want to see

my goal is i want to know if its possible to have a dynamic x-axis that if the client selects "Add to Carts" measure on the slicer, the axis will show the products distribution while if they choose the "Bounces" measure on the slicer, they axis will shift to showing by campaign distribution

is this possible?

@tamerj1 @johnt75 @amitchandak @FreemanZ @v-yueyunzh-msft 

1 ACCEPTED SOLUTION

i did it kinda, i made a new field parameter called "X-axis Paramter" and added the fields "Campaign" and "Product"

but since my fields parameter for the measures has 11 measures and order from 0 to 10

i had to do this

 

GA X-Axis Slicer = {
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 0),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 1),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 2),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 3),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 4),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 5),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 6),
    ("Product", NAMEOF('Product Analysis'[Product]), 7),
    ("Product", NAMEOF('Product Analysis'[Product]), 8),
    ("Product", NAMEOF('Product Analysis'[Product]), 9),
    ("Product", NAMEOF('Product Analysis'[Product]), 10)
}

 

 

then make a relationship between order column of x-axis and order column of measure parameter.

so now when i select the measure from the slicer 
it will return the x-axis desired.

it works perfectly but i would like to know if there is a better more effiecent way to do it because what if i had many more measures 

View solution in original post

4 REPLIES 4
tamerj1
Community Champion
Community Champion

Hi @eliasayyy 
Probably can be done but you need to share a sample file.

i did it kinda, i made a new field parameter called "X-axis Paramter" and added the fields "Campaign" and "Product"

but since my fields parameter for the measures has 11 measures and order from 0 to 10

i had to do this

 

GA X-Axis Slicer = {
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 0),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 1),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 2),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 3),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 4),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 5),
    ("Campaign", NAMEOF('Campaign Analysis'[Campaign]), 6),
    ("Product", NAMEOF('Product Analysis'[Product]), 7),
    ("Product", NAMEOF('Product Analysis'[Product]), 8),
    ("Product", NAMEOF('Product Analysis'[Product]), 9),
    ("Product", NAMEOF('Product Analysis'[Product]), 10)
}

 

 

then make a relationship between order column of x-axis and order column of measure parameter.

so now when i select the measure from the slicer 
it will return the x-axis desired.

it works perfectly but i would like to know if there is a better more effiecent way to do it because what if i had many more measures 

@eliasayyy 
Actually this is what I had in mind 😄

I was just afraid that adding the new relationships will create ambiguity as I have no idea how your data model look like.

oh well in that case thank you very much for the help

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.