DAX for a Calendar Table

Home Power BI DAX DAX for a Calendar Table

Most Power BI models require a date table. Just ad a new table to your model and copy-paste this code to get one.

Here it is:

dim_Calendar =
ADDCOLUMNS (
CALENDAR (
MIN ( fact_Sales[Date] ),
MAX ( fact_Sales[Date] )
),
"Month" , MONTH ( [Date] ),
"MonthName" , FORMAT ( [Date] , "mmmm" ),
"Year" , YEAR ( [Date] ),
"Quarter" , "Q" & QUARTER ( [Date] ),
"YearMonth" , YEAR ( [Date] ) * 100 + MONTH ( [Date] ),
"Day", DAY ( [Date] )
)