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

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
New Ranks and Rank Icons in 2020

New Ranks and Rank Icons in 2020

Read the announcement for more information!

New Kudos Given Badges Coming

New Kudos Given Badges Coming

We're rolling out new Kudos Given badges. Find out how many Kudos you've given.

November 2019 Community Highlights

November 2019 Community Highlights

Get an overview of the events and great community content from November.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)