Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

DAX Date in Direct Query mode

Hi everyone

First of all, thanks for you work guys.
Second, I used this function[1] without problems until it stopped working last week, I am in Direct Query mode. When writing it to DAX, the following message appears: "Not a legal OleAut date. The exception was raised by the IDataReader interface."

Version: 2.65.5313.701 64-bit (2018 December)
Anybody can help me?

[1]

FechasDax = 
VAR BaseCalendar = 
    CALENDARAUTO()
RETURN
    GENERATE(
        BaseCalendar,
        VAR BaseDate = [Date]
        VAR YearDate = Year(BaseDate)
        VAR MonthNumber = Month(BaseDate)
        RETURN ROW(
            "Day", BaseDate, 
            "Year", YearDate,
            "Month Number", MonthNumber,
            "Month", FORMAT(BaseDate,"mmmm"),
            "Month Year", FORMAT(BaseDate,"mmm yy")
        )
    )

 

1 Reply

  • v-lili6-msft's avatar
    v-lili6-msft
    Community Support

    hi, Anonymous

    I have tested it by your formula on my side, but not reproduce the issue.

    So please

    1. try to update power bi desktop to the latest version.

    2. check the actual date values in your table, You most probably have some date with the wrong, look all your date values, try sorting and checking de min and max value of each field.

     

    Best Regards,

    Lin