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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
GetITDone
Frequent Visitor

How to calculate # of days from a certain date field using DirectQuery

How to calculate # of days from a certain date field using DirectQuery.  

 

I was hoping for something like Days Overdue = DATEDIFF([ActualCloseDate], TODAY(),DAY) but this doesn't work.  Can you please help me but explain to me with some good details on the steps I need to take.  I am not a coder.  Thank you.

5 REPLIES 5
Anonymous
Not applicable

I do something very similiar in a file I work on. My calculation looks like:

 

Months From Today = DATEDIFF('Date'[Date Master], TODAY(), MONTH)
 
Are you sure you are calling a Date field?

For some reason when I type = DATEDIFF(myqueryname... 'query2' the formula does not recognize it.  😞 

Hi @GetITDone ,

 

If you want to create a measure using Datediff, we need to use min/max/selectvalue to get the date value, such as following:

 

Days Overdue = DATEDIFF(MIN('20191111-DQ'[PhaseoutDate]),TODAY(),DAY)

 

6.jpg


Best regards,
 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

I do not have allow direct query option to choose from in the settings.  Only 'Treat SAP HANA as a relations source'

Any other ideas?   Thank you.

 

 
 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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