Forum Discussion

RNightscape's avatar
RNightscape
Frequent Visitor
7 years ago
Solved

DATEADD works for some cells.

Hi all, 

I'm try to filter to create a measure and It will do a Dateadd (days) on my start column.

The strannge it's because depends the filter I use, works for some model and not for others....  How  Could I resolve this?

 

 

 

  • Hi RNightscape

    As tested and disscussed widely, it is impossible to use dateadd in a measure in this way, i would suggest you to use "+" function direactly.

    Please see my test for example.

    create a new table with week and days to the week as below.

    this table should have no relationship with your data table.

    Then create a measure

    Measure 2 = SELECTEDVALUE(Sheet5[start])+SELECTEDVALUE(Table1[week])*7

     

4 Replies

  • v-juanli-msft's avatar
    v-juanli-msft
    Icon for Community Support rankCommunity Support

    Hi RNightscape

    I can't create such measure to get "dateadd" measure displaying on the table visual as yours. When i use the following measure and add it in the table visual, it will return an error.

    Measure 4 = DATEADD(Sheet5[start],1,DAY)

    Could you tell me how to you calculate the "Test" measure?

     

    Below is my test with function "dateadd" which would explain for why some value would not show.

    As tesed, when the "date" column is not continuous,"dateadd" function doesn't return any value.

    With continuous dates, it could return the dates which can be found in your "date" column,

    for example, in the following table, "DATEADD" function should  return 2018/1/5 for the last row, but  2018/1/5 can't be found in the "Column1", so it returns blank actually.

     

    The problem above can be solved by the following formula.

    • RNightscape's avatar
      RNightscape
      Frequent Visitor

      Hi v-juanli-msft, really thanks by your help.

       

      I calculated using this.

       

       

       

       

      I tried to populate ".[DATE]" but isn't worked well.

  • v-juanli-msft's avatar
    v-juanli-msft
    Icon for Community Support rankCommunity Support

    Hi RNightscape

    As tested and disscussed widely, it is impossible to use dateadd in a measure in this way, i would suggest you to use "+" function direactly.

    Please see my test for example.

    create a new table with week and days to the week as below.

    this table should have no relationship with your data table.

    Then create a measure

    Measure 2 = SELECTEDVALUE(Sheet5[start])+SELECTEDVALUE(Table1[week])*7