asmgx
asmgx

Reputation: 7984

Change X-Axis displayed values in Power BI

I have built a bar chart in Power BI

the chart looks fine except the the X-Axis naming is not changeable

I want the data to be sorted the way they are, but the name of each bar is typed differently

enter image description here

at the moment the X-Axis showing

April / May / June / July / etc.

I want it to show a different label example

4-18 / 5-18 / 6-18 / 7-18 / etc

I created a computed column and used the naming I wanted it in it

but the order was wrong in the chart

I got this

1-18 / 10-18 / 11-18 / 12-18 / 2-18 / 3-18 / etc.

even with leading 0 I got this

01-17 / 01-18 / 02-17 / 02-18 / etc.

Is there any way I can change the X-Axis label without disturbing its order?

Upvotes: 3

Views: 16497

Answers (1)

Foxan Ng
Foxan Ng

Reputation: 7151

The column you created is sorted as text. That's why 01-18 comes before 02-17. To sort them by date, you can create another integer column, e.g. YearMonthKey, and then sort the column you created (e.g. YearMonthText) based on YearMonthKey.

data

sort by

Before:

before

After:

after

Upvotes: 7

Related Questions