Forum Discussion
Creating a Date
- 8 years ago
Hey,
I would do the following, by creating three new calculated columns.
The first column just concatenates the existing Year and Month columns (this will be used as axis), this concatenation can be done by this DAX statement:Year-Month = 'Table1'[Year] & " " & 'Table1'[Month]
Than I create a real date column using this DAX statement:
Date = DATE('Table1'[Year], SWITch('Table1'[Month] ,"January", 1 ,"February",2 ,"March",3 ,"April",4 ,"May",5 ,"June",6 ,"July",7 ,"August",8 ,"September",9 ,"October",10 ,"November",11 ,"December",12 ),1)Be aware that a date always needs a Day, for this reason I used 1 as the 1st of the month, the last parameter of the DAY(year,month,day) formula.
The 3 column is a running index that uniquely identiefies a the combination of year and month, i will use this column to order the "Year-Month" column. To create this index I use this DAX statement:
RunningMonthIndex = (YEAR('Table1'[Date])-YEAR(MIN('Table1'[Date])))*12+MONTH('Table1'[Date])My final table would look like this:
Now in the Data view you can mark the Year-Month column, in the modeling menu choose "Sort by column" from the "Sort" ribbon and select RunningMonthIndex.
You can hide both columns "Date" and "RunningMonthIndex" in the report view, to minimize complexity for the users of the report.
Hopefully this is what you are looking for.
Regards
Tom
Wow - thanks Tom - I will give that a run !
I think you can achieve the same by putting both Year and Month fields (2 separate fileds, not combined one) in the axis and drilling down with the 'fork' icon. You will still need to set custom order for the months from 1 to 12