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
Shelley
Continued Contributor
Continued Contributor

DATESBETWEEN is Running Past Current Date

I'm hoping I'm just missing something simple. I'm struggling to figure out how to do what I want.

 

I am trying to calculate Machine Downtime within a 90 Day rolling window. In other words, I want to calculate the total Machine Downtime in the last 90 days, every day. I think I have the rolling part working, but it is giving data for dates beyond today, which probably has something to do with our date calendar, spanning many years before today and beyond today.  I was trying to use NOW() or TODAY() for the start date, but I must be trying to use those functions improperly.  Here's what I have:

 

Test 90-Days Rolling Downtime =
CALCULATE([Total Downtime (Secs)],
   DATESBETWEEN('Daily Calendar'[Date],
       NEXTDAY(DATEADD(LASTDATE('Daily Calendar'[Date]),-90, DAY)),
           LASTDATE('Daily Calendar'[Date])))

 

Your expertise is greatly appreciated. Thanks!

1 REPLY 1
TomMartens
Super User
Super User

Hey,

 

maybe it would be helpful to use

LASTNONBLANK('Daily Calendar'[Date], SUM('FactTable'[column]))

this would return the last date from your facttable

 

Hope this may help



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.