Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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))

View solution in original post

5 REPLIES 5
v-zhenbw-msft
Community Support
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"))

 

DAX1.jpg

 

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
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")

 

 

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

Anonymous
Not applicable

@amitchandak 

 

Selected closed date.  Is my dax above correct or do I have to modify something there?

amitchandak
Super User
Super User

@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))

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.