Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

DAX for dates

Hi guys

I'm trying tabulate a bar chart for some overdue jobs but i have to pre-alert my users 2 days before the job overdue. 
let say the job is going to overdue on 3 July, by today (1 july) users able to see what are the jobs that are going to overdue for 3 July.
any date intelligent dax or solution for it?

Many thanks for advance!

  • Anonymous , assume due date is joined to date table

    CALCULATE(Count(Job[Job ID]),dateadd('Date'[Date],2,Day))

     

    This will jobs due after 2 days

    Or

    CALCULATE(Count(Job[Job ID]),filter(all(Date),Date[Date] =Today()+2))

5 Replies

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Community Support

    Hi Anonymous ,

     

    Sorry for that we don’t understand what is your desire result clearly.

    We create a sample, and find a measure solution to distinguish between expiry and expiry after two days.

     

    Measure = 
    IF(MAX('Table'[overdue Date])<=TODAY(),"expired",IF(MAX('Table'[overdue Date])<=TODAY()+2,"Expires in two days","Not expired"))

     

     

    If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?

     

    It will be helpful if you can show us the exact expected result based on the tables.

    Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

     

    BTW, pbix as attached.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      hi v-zhenbw-msft 

       

      amitchandak  had solved it. However I have another question for your dax, which might help me for my query.

       

      If I want to count any of my overdue dates which exceeded 30days. Is it correct below?

       

       

      if(max(table[overdue]) = (table[overdue])+30, "exceeded 30days", "before 30days")

       

       

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , This need to compare with selected close date or selected date Today's adte

  • Anonymous , assume due date is joined to date table

    CALCULATE(Count(Job[Job ID]),dateadd('Date'[Date],2,Day))

     

    This will jobs due after 2 days

    Or

    CALCULATE(Count(Job[Job ID]),filter(all(Date),Date[Date] =Today()+2))