Forum Discussion
Help with sorting the matrix
- 1 year ago
Hi wardy912 & mdaatifraza5556
Thank you for your reponse,
I have date dim table and month sort column as well,.
The issue was with other values apart from month values, so I just added the custom sorting column in PQ and then sorted the month column in the report view and it worked.
Regards
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!