The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Dear developers,
I need your help to sort the matrix visuals based on months, along with months I have some other values as well in the columns, you can put them at last after months.
Please support.
Thanks
Hi @Lio123
It's best practice to add a date table and relate to your fact table date, here's one I made earlier!
Date =
ADDCOLUMNS (
CALENDAR (
MIN ( [Date column from existing table] ),
MAX ( [Date column from existing table] )
),
"MonthNo", MONTH ( [Date] ),
"MonthName", FORMAT ( [Date], "MMMM" ),
"MonthYear", FORMAT ( [Date], "MMMM YYYY" ),
"MonthYearShort", FORMAT ( [Date], "MMM YY" ),
"MonthYearNo", FORMAT ( [Date], "YYYYMM" ),
"Quarter", QUARTER ( [Date] ),
"Year", YEAR ( [Date] ),
"Day", DAY ( [Date] ),
"WeekNumber", WEEKNUM ( [Date] ),
"WeekdayNum", WEEKDAY ( [Date] ),
"WeekdayName", FORMAT ( [Date], "DDDD" ),
"PreviousWeek", WEEKNUM ( [Date] ) -1 ,
"WeekStartDate", ([Date] - WEEKDAY ( [Date] , 1 ) +1),
"WeekEndDate", ([Date] - WEEKDAY ( [Date] , 1 ) +7),
"YearMonth", FORMAT ( [Date], "YYYY-M" )
)
You can then sort the columns by my sorting columns (e.g. sort MonthName by MonthNo).
Go to the table view and select 'sort by column' from the 'column tools' toolbar.
That will show the months in the right order.
You could add a sort column to your fact table, but a date table is definitely preferable.
I hope this helps, please give a thumbs up and mark as solved if it does, thanks!
Hi @Lio123
Did you try creating a Month Number column in the Date table and then sorting the Month Name column by that Month Number?
Follow to get it
Create Month No column for sorting
Click on month name column and then sort by column from the ribbon and select month no.
Result
If this answers your questions, kindly accept it as a solution and give kudos.