Skip to content

Instantly share code, notes, and snippets.

@Tadge-Analytics
Created October 21, 2019 06:15
Show Gist options
  • Save Tadge-Analytics/0009fd461b69b37f3d23d713c2adb83c to your computer and use it in GitHub Desktop.
Save Tadge-Analytics/0009fd461b69b37f3d23d713c2adb83c to your computer and use it in GitHub Desktop.
Dates =
VAR Days = CALENDAR(MIN('Order'[Order Date]), MAX('Order'[Order Date]) )
RETURN ADDCOLUMNS (
Days,
"Year", YEAR ( [Date] ),
"Month Number", MONTH ( [Date] ),
"Month", FORMAT ( [Date], "mmmm" ),
"Year Month Number", YEAR ( [Date] ) * 12 + MONTH ( [Date] ) - 1,
"Year Month", FORMAT ( [Date], "mmm yy" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"Year Quarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" ),
"Week of Year", WEEKNUM([Date])
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment