Forum Discussion

AnandNamburi's avatar
AnandNamburi
Icon for Helper III rankHelper III
5 years ago
Solved

a column specified in the call to function 'dateadd' does not of type date. this is not supported

Hi All,   While writing the Dateadd in a DAX calculation I'm getting the error like below. a column specified in the call to function 'dateadd' does not of type date. this is not supported.   Th...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi AnandNamburi 

    In addition to  

    M.PP1 = 
    CALCULATE (
        SUM ( Orders[Sales] ),
        FILTER (
            ALL(Orders),
            Orders[Order Date].[Year]
                = MAX(Orders[Order Date].[Year])-1
    ))

    Result is as below.

    Or you can build a calendar table and relate two tables by date column.

    Calendar Table:

    Calendar = ADDCOLUMNS(CALENDAR(MIN(Orders2[Order Date]),MAX(Orders2[Order Date])),"Year",YEAR([Date]))

    Then build a measure as below.

    2.PP1 = CALCULATE(SUM('Orders2'[Sales]),DATEADD('Calendar'[Date],-1,YEAR))

    Result is as below.

    You can download the pbix file from this link: a column specified in the call to function 'dateadd' does not of type date. this is not supported

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.