Skip to content

Instantly share code, notes, and snippets.

@jrotello
Created January 18, 2017 07:18
Show Gist options
  • Save jrotello/e9dffc0dfae312ae63f93935cc7ae856 to your computer and use it in GitHub Desktop.
Save jrotello/e9dffc0dfae312ae63f93935cc7ae856 to your computer and use it in GitHub Desktop.
DAX Calendar Table Generator
Calendar = ADDCOLUMNS (
CALENDAR (DATE(2016,1,1), DATE(2018,12,31)),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"MonthNo", FORMAT ( [Date], "MM" ),
"YearMonthNo", FORMAT ( [Date], "YYYY/MM" ),
"YearMonth", FORMAT ( [Date], "YYYY/mmm" ),
"MonthShort", FORMAT ( [Date], "mmm" ),
"MonthLong", FORMAT ( [Date], "mmmm" ),
"WeekDayNo", WEEKDAY ( [Date] ),
"WeekDay", FORMAT ( [Date], "dddd" ),
"WeekDayShort", FORMAT ( [Date], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" )
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment