I edited the table above to inclue ISO Week number, which also helped fix the Week Ending values. Should be more accurate now. Please let me know if you figure out how to break it!
To get dates to sort in the correct order I used this one
MonthT = FORMAT([Date], "MMM") & " " & [Year])
MonthN = MONTH([Date])
And then sorted by SUM OF MonthN as a value
Edit Actually there is a much better way to do this as shown below
I am probably missing something but when I enter the DateTable = CALENDAR (MINX('FactTable', [Created Date]), NOW()) in a new table it says it cant find FactTable. I changed this to a table I had imported and then it says Created Date cannot be found.
I am very new to DAX so would appreciate if you could explain a bit further please as this looks very useful.
Did you put for minx
1 The table name 'Account Transactions',
2 The field name 'Account Transactions'[Date]) ,
DateTable = CALENDAR( minx ( 'Account Transactions', 'Account Transactions'[Date] ) , today ())
Actually the correct way to do this si shown in this thread
Nice tip. As usual, there are several ways to do the same thing with DAX. A function similar to CALENDAR is CALENDARAUTO which scans all the date columns and returns a range of dates from the earliest date to the latest date. It is very handy.
@lanceengland However, the CALENDARAUTO isn't dynamic right? I mean it scans for all the dates from earliest to the latest. But if the data source is updated, the CALENDARAUTO doesn't update automatically. Someone can correct me if i'm wrong.
Edit: I just realized that CALENDARAUTO is in fact dynamic. Tried it with an Excel data source. Removed some dates and the table named DateTable (created with calendarauto) updated its date range after a refresh.
Yes. Dynamic is this sense is at process time i.e. refreshing the data model from the data source. On that note, while I haven't verified it, I'm guessing CALENDARAUTO would not work in Direct Query mode. That said, if you were in Direct Query mode, you would handle the dynamic date range at the data source.