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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Tahech
Helper I
Helper I

How to change X-Axis conditionally?

My problem:

 

I'm visualizing a graphic in Months (x-axis) by Value (y-axis).

 

When I click over June (for example) I want to change the x-axis from "Month" to "Clients". Then my graphic will show me the days of the month select (June) e the Value (y-axis) by Clients (the new x-axis)

 

Is it possible?

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Picture2.png

Creating a new table.

Axis table = 
SELECTCOLUMNS (
    UNION (
        ALL ( 'Calendar'[Month-Year], 'Calendar'[End of Month] ),
        ALL ( Clients[Clients], Clients[Index] )
    ),
    "@Axis", [Month-Year],
    "@index", 'Calendar'[End of Month]
)

 

Creating a measure

Desired outcome measure: = 
IF (
    NOT ISFILTERED( 'Calendar'[Month-Year] ),
    CALCULATE (
        SUM ( Data[Value] ),
        TREATAS ( VALUES ( 'Axis table'[@Axis] ), 'Calendar'[Month-Year] )
    ),
    CALCULATE (
        SUM ( Data[Value] ),
        TREATAS ( VALUES ( 'Axis table'[@Axis] ), Clients[Clients] )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Tahech ;

Is your problem solved? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.


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

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Picture2.png

Creating a new table.

Axis table = 
SELECTCOLUMNS (
    UNION (
        ALL ( 'Calendar'[Month-Year], 'Calendar'[End of Month] ),
        ALL ( Clients[Clients], Clients[Index] )
    ),
    "@Axis", [Month-Year],
    "@index", 'Calendar'[End of Month]
)

 

Creating a measure

Desired outcome measure: = 
IF (
    NOT ISFILTERED( 'Calendar'[Month-Year] ),
    CALCULATE (
        SUM ( Data[Value] ),
        TREATAS ( VALUES ( 'Axis table'[@Axis] ), 'Calendar'[Month-Year] )
    ),
    CALCULATE (
        SUM ( Data[Value] ),
        TREATAS ( VALUES ( 'Axis table'[@Axis] ), Clients[Clients] )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.