Forum Discussion

Dirk_Kuypers's avatar
Dirk_Kuypers
Frequent Visitor
5 years ago
Solved

Next date after "today"

Hello,

 

I have a table with much data. There are 2 columns that I want to use to find the next date after "today" when the task is due to be done.

One table has a start date when the task was done the first time en an other table with a frequency set in days.

How can I calculate the first date after today when I need the task again?

 

 

  • Hi Dirk_Kuypers 

    Please try below measure. I simplified the model by using only one table, so change table names per your need. Since your data is from two tables, you will need to create relationship based on Order ID.

    Next Date = 
    VAR __startDate = SELECTEDVALUE('Table'[Start Date])
    VAR __frequency = SELECTEDVALUE('Table'[Frequency (days)])
    VAR __nextDate = __startDate + __frequency * (INT(DIVIDE(DATEDIFF(__startDate,TODAY(),DAY),__frequency)) + 1)
    RETURN
    __nextDate

     

    Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello Dirk_Kuypers ,

    you can try with the custom column

    next day = TODAY()+1
  • Dirk_Kuypers's avatar
    Dirk_Kuypers
    Frequent Visitor

    Hello Anonymous 

     

    That is not what I'm looking for.

    For exampel, the first order was released on 21-02-2015 and has a frequency of 14 days. So the next order was on 7-3-2015, then 21-03-2015 and so on.....

    I now only want to see the next date after "today". So the value has to be 27-3-2021. The older dates I don't need.

  • v-jingzhang's avatar
    v-jingzhang
    Icon for Community Support rankCommunity Support

    Hi Dirk_Kuypers 

    Please try below measure. I simplified the model by using only one table, so change table names per your need. Since your data is from two tables, you will need to create relationship based on Order ID.

    Next Date = 
    VAR __startDate = SELECTEDVALUE('Table'[Start Date])
    VAR __frequency = SELECTEDVALUE('Table'[Frequency (days)])
    VAR __nextDate = __startDate + __frequency * (INT(DIVIDE(DATEDIFF(__startDate,TODAY(),DAY),__frequency)) + 1)
    RETURN
    __nextDate

     

    Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.