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
alvin199
Helper III
Helper III

Rename Axis from Auto Label

I am grouping the age using Data Groups function in Power BI. In its setting, I have selected Size of bins and Power BI auto detected the minimum and maximum values of the age column are 19 and 50 respectively. So, it will decide the number of group.

Group_d.png

 

I have the output in the bar chart below. My question is how can I rename the X-axis. For example the first bar is name as 1-19, second bar is 20-29, and etc. 

alvin199_0-1645637429516.png

 

1 ACCEPTED SOLUTION

Something like this as a new column...

Age Range = 
    SWITCH(
        TRUE(),
        'Table'[Age] < 19, "0 - 19",
        'Table'[Age] < 39, "20 - 39",
        'Table'[Age] < 59, "40 - 59",
        "60+"
        )

Substitute your table name and column name.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

2 REPLIES 2
KNP
Super User
Super User

It might be possible to create a custom label for the axis as a new column based on the bin values, but, to be honest, it is probably easier to just control the grouping yourself. This could be done in Power Query or DAX depending on your preference.

This is a good article to explain one way to approach it...

https://radacad.com/create-customized-age-bins-or-groups-in-power-bi

There are a number of links in there showing how to make it controllable with measures also.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Something like this as a new column...

Age Range = 
    SWITCH(
        TRUE(),
        'Table'[Age] < 19, "0 - 19",
        'Table'[Age] < 39, "20 - 39",
        'Table'[Age] < 59, "40 - 59",
        "60+"
        )

Substitute your table name and column name.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

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.