Forum Discussion

guibenassi's avatar
guibenassi
Advocate II
7 years ago
Solved

DATEADD ERROR

I create some measures with dateadd and I suspect that are some errors on that.

Then I create a calculated columm to see the DATEADD working and prove the problem.

I read some comments about using a date table, but I don´t want to use a date table for some reasons.

Above the table, with the calculated columm and it is possible to see some blank lines.

  • Hi guibenassi ,

     

    Without an extra date table, please try below formula:

    Vcto Ajustado=DATEADD('Receber E1'[E1_BAIXA2].[DATE];-15;DAY)

    Best regards,

    Yuliana Gu

3 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi guibenassi ,

     

    Without an extra date table, please try below formula:

    Vcto Ajustado=DATEADD('Receber E1'[E1_BAIXA2].[DATE];-15;DAY)

    Best regards,

    Yuliana Gu

    • edhans's avatar
      edhans
      Community Champion

      v-yulgu-msft wrote:

      Hi guibenassi ,

       

      Without an extra date table, please try below formula:

      Vcto Ajustado=DATEADD('Receber E1'[E1_BAIXA2].[DATE];-15;DAY)

      Yes, that will work but note that you must have AutoDate features enabled for this to work. Something I didn't think about because I always have it disabled. :smileyhappy:

  • edhans's avatar
    edhans
    Community Champion

    You have to create a Date table. The reason they are returning blanks is the dates that are being calculated don't exist in the column you are using as your source. See this thread for a more comprehensive explanation.

     

    DATEADD() isn't like an Excel function. It relies on a true Date table to work for both calculated columns and measures.

     

    You could do this in Power Query though if you are insistent in not createing a date table. See the Date.AddDays() function there. However, that would create a column and still wouldn't solve your original problem of wanting this in a measure.