Last active
November 25, 2018 00:11
-
-
Save stuarthallows/9bdcab41489febcda5d3ca1779927d67 to your computer and use it in GitHub Desktop.
DAX to generate a date table for all dates in the model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dates = | |
VAR BaseCalendar = CALENDARAUTO() | |
RETURN | |
GENERATE ( | |
BaseCalendar, | |
VAR BaseDate = [Date] | |
RETURN ROW ( | |
"Year", YEAR(BaseDate), | |
"Quarter", INT(FORMAT(BaseDate, "q")), | |
"Month", MONTH(BaseDate), | |
"Day", DAY(BaseDate), | |
"MonthShortName", FORMAT(BaseDate, "MMM"), | |
"MonthFullName", FORMAT(BaseDate, "MMMM"), | |
"Year Month", FORMAT(BaseDate, "MMM yy") | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from the sqlbi blog.