Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
How to Sort the Axis in a Chart which is having Month and Year (MMM-YY) and uses data from Power BI dataset live connect.
1. I have one date column, with that date column create one calculated column with format(mm-yyyy).
Hey @Anonymous
to sort your month-year column you have to add a new column with below mentioned DAX.
Sort month year = FORMAT(YourTable[DateColumn], "yyyymm")
If this helps you please mark my solution as accepted so that other users can find this quickly when they face similar issue. Thank You!
Hey @Anonymous ,
by default the values in a slicer or on an axis are sorted by name, this means April first instead of January. For this reason you have to create an extra column that contains a sort index.
Based on a date column you can use this DAX to create a numeric value that can be used for the ordering:
YearMOnthSort = YEAR( 'tablename'[datecolumn] ) * 100 + Month ( 'tablename'[datecolumn] )
This article describes how to sort one column by a 2nd column: https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column?tabs=powerbi-desktop
Hopefully, this provides what you are looking for.
Regards,
Tom
User | Count |
---|---|
84 | |
76 | |
74 | |
48 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |