Forum Discussion
Why does my DAX Datetable not include dates for 2020?
My DAX datetable is:
Date =
VAR MinYear = 2018
VAR MaxYear = 2020
RETURN
ADDCOLUMNS (
FILTER (
CALENDARAUTO( ),
AND ( YEAR ( [Date] ) >= MinYear, YEAR ( [Date] ) <= MaxYear )
),
"Calendar Year", "CY " & YEAR ( [Date] ),
"Month Name", FORMAT ( [Date], "mmmm" ),
"Month Number", MONTH ( [Date] ),
"Month End", EOMONTH([Date],0)
)
Why are there no dates for 2020 in this calendar table, only 2018 and 2019?
Hi ansa_naz
check if in your data exists data from 2020 because in CALENDARAUTO() function range of dates is calculated automatically based on data in the model.
You can also use CALENDAR() function instead https://docs.microsoft.com/en-us/dax/calendar-function-dax
do not hesitate to give a kudo to useful posts and mark solutions as solution
2 Replies
- az38Community Champion
Hi ansa_naz
check if in your data exists data from 2020 because in CALENDARAUTO() function range of dates is calculated automatically based on data in the model.
You can also use CALENDAR() function instead https://docs.microsoft.com/en-us/dax/calendar-function-dax
do not hesitate to give a kudo to useful posts and mark solutions as solution
- ansa_nazContinued Contributor
Thanks for that, didnt realise the CALENDARAUTO function uses dates in the data model. Used CALENDAR and it works perfectly, cheers