Forum Discussion

NL-Nicolas's avatar
NL-Nicolas
Helper I
3 years ago
Solved

DateAdd Alternative for Function retrieving a Date, and Making a new Date

Hey Community!   I am getting an error from my calculated column when I try to filter it due to using DateAdd, how can I resolve this? Column in Questions Week LY = CALCULATE( Sum(DayfileSummary...
  • v-cazheng-msft's avatar
    3 years ago

    Hi NL-Nicolas,

     

    This issue is caused by the first parameter in your DATEADD function. According to the syntax of DATEADD, you must provide a column that contains dates. And the dates argument can be any of the following:

    1 A reference to a date/time column,

    2 A table expression that returns a single column of date/time values,

    3 A Boolean expression that defines a single-column table of date/time values.

     

    For more details about the usage of DATEADD, please have a look at DATEADD function (DAX) - DAX | Microsoft Docs.

     

    To solve this problem, you need make sure the first parameter is a date/time column by changing its date type or replace it with a date column from a Date/Calendar table. Here is a similar that may help you: Solved: DATEADD "expects a contiguous selection when the d... - Microsoft Power BI Community.

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!

     

    Best Regards,

    Community Support Team _ Caiyun