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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
saipawar
Helper IV
Helper IV

calculate number of days past specific date

Hi, 

 

I would like to show a timer that shows 'number of days' past the event. 

So if the event occurred Oct 5,

on Oct 6 - the timer should show 1. 

 

Enhancement (if possible)- 

If I can show past  day, hour, minutes

4 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

=TODAY() - [Event Date]

=NOW() - [Event Date/Time]

 

use FORMAT to show the desired output.

View solution in original post

SachinNandanwar
Super User
Super User

Not completely sure what is the ask. Is this something that you are looking for ? I have expressed the ourtput in terms for hours.

SachinNandanwar_0-1729291689630.png

 

 

No of Hours since last event = 
VAR _Dt =
    MAX ( Events[Date] )
VAR _tbl =
    FILTER ( ALL ( Events ), Events[Date] < _Dt && Events[Event Occurred] =1 )
VAR _Dt1 =
    MAXX ( _tbl, Events[Date] )
RETURN
    DATEDIFF ( _Dt1, _Dt, HOUR )

 

 



Regards,
Sachin
Check out my Blog

View solution in original post

Bibiano_Geraldo
Super User
Super User

hi, You can use the following code to achieve your goal, dont forget to replace the column names with your owns

Time Past = 
VAR __Now = NOW()
VAR __EventDate = [EventDate]
RETURN 
FORMAT(__Now - __EventDate, "d \d\a\y\s\ h\ \h\o\u\r\s\ m\ \m\i\n\u\t\e\s")

 

View solution in original post

Kedar_Pande
Super User
Super User

@saipawar 

Create a Date Table

DateTable =
CALENDAR ( MIN ( 'YourTable'[EventDate] ), TODAY () )

Create a Measure for Days Passed

DaysPassed =
VAR EventDate =
DATE ( 2024, 10, 5 ) // Replace with your event date
RETURN
DATEDIFF ( EventDate, TODAY (), DAY )

Add a card visualization to your report and set its value to the DaysPassed measure. This will show the number of days since October 5.


Create a Detailed Timer Measure

DetailedTimer =
VAR EventDate =
DATE ( 2024, 10, 5 ) // Replace with your event date
VAR CurrentDateTime =
NOW ()
VAR TotalMinutes =
DATEDIFF ( EventDate, CurrentDateTime, MINUTE )
VAR Days =
INT ( TotalMinutes / 1440 ) // Total minutes in a day
VAR Hours =
INT ( MOD ( TotalMinutes, 1440 ) / 60 ) // Remaining hours
VAR Minutes =
MOD ( TotalMinutes, 60 ) // Remaining minutes
RETURN
FORMAT ( Days, "0" ) & " days "
& FORMAT ( Hours, "0" ) & " hours "
& FORMAT ( Minutes, "0" ) & " minutes"

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

 

View solution in original post

6 REPLIES 6
Kedar_Pande
Super User
Super User

@saipawar 

Create a Date Table

DateTable =
CALENDAR ( MIN ( 'YourTable'[EventDate] ), TODAY () )

Create a Measure for Days Passed

DaysPassed =
VAR EventDate =
DATE ( 2024, 10, 5 ) // Replace with your event date
RETURN
DATEDIFF ( EventDate, TODAY (), DAY )

Add a card visualization to your report and set its value to the DaysPassed measure. This will show the number of days since October 5.


Create a Detailed Timer Measure

DetailedTimer =
VAR EventDate =
DATE ( 2024, 10, 5 ) // Replace with your event date
VAR CurrentDateTime =
NOW ()
VAR TotalMinutes =
DATEDIFF ( EventDate, CurrentDateTime, MINUTE )
VAR Days =
INT ( TotalMinutes / 1440 ) // Total minutes in a day
VAR Hours =
INT ( MOD ( TotalMinutes, 1440 ) / 60 ) // Remaining hours
VAR Minutes =
MOD ( TotalMinutes, 60 ) // Remaining minutes
RETURN
FORMAT ( Days, "0" ) & " days "
& FORMAT ( Hours, "0" ) & " hours "
& FORMAT ( Minutes, "0" ) & " minutes"

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

 

Bibiano_Geraldo
Super User
Super User

hi, You can use the following code to achieve your goal, dont forget to replace the column names with your owns

Time Past = 
VAR __Now = NOW()
VAR __EventDate = [EventDate]
RETURN 
FORMAT(__Now - __EventDate, "d \d\a\y\s\ h\ \h\o\u\r\s\ m\ \m\i\n\u\t\e\s")

 

SachinNandanwar
Super User
Super User

Not completely sure what is the ask. Is this something that you are looking for ? I have expressed the ourtput in terms for hours.

SachinNandanwar_0-1729291689630.png

 

 

No of Hours since last event = 
VAR _Dt =
    MAX ( Events[Date] )
VAR _tbl =
    FILTER ( ALL ( Events ), Events[Date] < _Dt && Events[Event Occurred] =1 )
VAR _Dt1 =
    MAXX ( _tbl, Events[Date] )
RETURN
    DATEDIFF ( _Dt1, _Dt, HOUR )

 

 



Regards,
Sachin
Check out my Blog
lbendlin
Super User
Super User

=TODAY() - [Event Date]

=NOW() - [Event Date/Time]

 

use FORMAT to show the desired output.

How do I pass the event date to the measure

 

Past Days = NOW()-10.21.2025

Past Days = TODAY() - dt"2024-10-21"   

 

(i hope you meant 2024, not 2025)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors