cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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),

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

3 REPLIES 3
Phil_Seamark Super Contributor
Super Contributor

Re: Days Between Dates with Negatives

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!

ElizabethTachji Regular Visitor
Regular Visitor

Re: Days Between Dates with Negatives

Hi,

 

How do you count only work days between two dates?

 

Thanks

Elizabeth Tachjian

elizabeth@analyticsrealtime.com.au

Elizabeth Tachjian
Super User
Super User

Re: Days Between Dates with Negatives

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
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 487 members 3,945 guests
Please welcome our newest community members: