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
Greg_Deckler
Super User
Super User

Days Between Dates with Negatives

Have used this one countless times. The problem is that DAYSBETWEEN DAX function does not allow returning negative values, so instead use:

 

DaysBetween = ROUNDUP(1.*[Date]-[OtherDate],0),

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
3 REPLIES 3
Phil_Seamark
Employee
Employee

Here is an ugly alternative 🙂

 

Column = IFERROR(
DATEDIFF(Dates[Date],Dates[OtherDate],DAY),
-DATEDIFF(Dates[OtherDate],Dates[Date],DAY )
)


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi,

 

How do you count only work days between two dates?

 

Thanks

Elizabeth Tachjian

elizabeth@analyticsrealtime.com.au

Elizabeth Tachjian
Anonymous
Not applicable

Just add a column to your Date table that will mark a date as a weekday or weekend day and then filter appropriately in your measures.

Best
Darek

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.

Top Solution Authors