Forum Discussion

selected_'s avatar
selected_
Helper IV
5 years ago

Calculate expire date

I have products with  that are coming with expire date I want

 

How is this measure made that amount products that expering <30 days like those below?

 

 

 

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi selected_ 

     

    Use the below measure to get teh days left.

    Days_left = DATEDIFF(selectedvalue(table[expire_date]),TODAY(), DAY)

     

    Now for each of these charts use filter condition on days left as

    1. Less than or equal to 30

    Less than or equal to 60 and greater than 30

    Less than or equal to 180 and greater than 60

    greater than 180

     

      • NilR's avatar
        NilR
        Post Patron

        You need two measures OR combine intoone. one to calc the expired date them put into if statement:

         

        Days between = DATEDIFF(table[date],TODAY(), DAY)
        DATEDIFF (<start_date>, <end_date>, <interval>)

        then with If stament 
        IF([Days between]>= 30, "YES","NO')