Forum Discussion
Problem with sorting month names in calender table
Hello all,
I have a problem with sorting in calender table. I have a visual that shows the name of the month on the X-axis. To sort this correctly I selected the column "Month" and let this column then be sorted by column "MonthYearNum". The problem is now that this is working when there is only one year in the calender table (e.g. 2023). But when an additional year is in the calender table (e.g. 2023 and 2024) it is no longer possible to sort the "Month" column by "MonthYearNum" column. I get an error message telling me that I have to sort by another column as it is not possible to have more than one value in "MonthYearNum" for the same value in "Month". You can see the structure of my calender table below and the also the error message (in German).
I am more or less sure that this was working some months ago with an older version of Power BI Desktop. What also is strang is that when I only have one year in the calendar then it is possible to sort the month name by "MonthYearNun". When this has been setup and after that I add an additional year to the calendar table the sorting is still working. But when I then switch the sorting to another column and then try to switch back to "MonthYearNum" I get the error message again.
So my question is now what is going wrong and how can I use the calendar table to show the name of the month on the X-Axis but sorting them correctly by using the column "MonthYearNum" for it?
Regards
Frank
9 Replies
- PijushRoyCommunity Champion
Hi FrankWe
Please create a lookup table by enter data for MONTH SORTMonth MonthSort January 1 February 2 March 3 April 4 May 5 June 6 July 7 August 8 September 9 October 10 November 11 December 12
In this table month should be Sort By "MonthSort" columnCreate a relationship with your fact table with "Month" column
Use "Month" from Lookup table in visual
Let me know if that works for you
If your requirement is solved, please make THIS ANSWER a SOLUTION βοΈ and help other users find the solution quickly. Please hit the LIKE π button if this comment helps you.
Thanks
Pijush
Linkedin- FrankWeHelper II
Hi Pijush,
I have the same info (MonthNumber) in my calender table, too. But I will try and let you know.
Frank