Forum Discussion

Oskar's avatar
Oskar
Helper I
4 years ago
Solved

Creating new table - date-table : i get different results?

I am creating a date-table using this DAX code.

DATES = 
VAR BaseCalendar =
    CALENDARAUTO(1)
RETURN
    GENERATE (
        BaseCalendar,
        VAR BaseDate = [Date]
        VAR YearDate = YEAR ( BaseDate )
        VAR DayDate = DAY ( BaseDate )
        VAR MonthNumber = MONTH ( BaseDate )
        VAR YearMonthNumber = YearDate * 12 + MonthNumber - 1
        RETURN ROW (
            "Day", BaseDate,
            "Year", YearDate,
            "Month Number", MonthNumber,
            "Month", FORMAT ( BaseDate, "mmmm" ),
            "Year Month Number", YearMonthNumber,
            "Year Month", FORMAT ( BaseDate, "mmm yy" ),
            "MyDate", FORMAT( BaseDate, "yyyy-mm-dd" )
        )
    )

 

It all works to get a date table.

But i cant figure out why it only goes back to 2021-02-01

I want it further back in the past and also look a bit more ahead...

 

I use the exact code in another PowerBI report and there i get a table going back to 1899-01-01 ... that is a bit to much but i want to understand what is happening here... why do i get different results?

 

how?

2 Replies