Search code examples
powerbidaxpowerquerydata-analysispowerbi-desktop

Power BI Remove year in Chart visual x-Axis but sort by month and year


In my data I compare the sales amount of diferent years but to show them in the same chart, I faked the year in my data. It always start in 2000.
The legend shows the name of the SalesEvent.

My sorting of the x-Axis works perfekt if I use the date-hierarchy.
enter image description here

But if I remove the year from the date-hierarchy the sorting fails and adds e.g. December into one x-Axis-Point.
enter image description here

Is it possible to let the visual look like the upper one, only without the fake year? Please let me know


Solution

  • Yes, this is possible.

    You need to generate a new column of months with a variable number of zero-wdith spaces after the month name (i.e. Jan from year 2000 will have 1 space where as Jan from year 2001 will have 2 spaces) and then create a sort column to sort these according to their real dates. You can then use this new column in the axis and have two Jans shown in the correct order. It is similar to the technique here: https://www.sqlbi.com/articles/handling-customers-with-the-same-name-in-power-bi/