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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Solution Specialist
Solution Specialist

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
Resident Rockstar
Resident Rockstar

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")

 

I hope this helps! 
If you found this answer helpful:
✔️ Mark it as the solution to help others find it faster.
 Give it a like to show your appreciation!

Thank you for contributing to our amazing Power BI community! 

View solution in original post

Kedar_Pande
Resident Rockstar
Resident Rockstar

@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
Resident Rockstar
Resident Rockstar

@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
Resident Rockstar
Resident Rockstar

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")

 

I hope this helps! 
If you found this answer helpful:
✔️ Mark it as the solution to help others find it faster.
 Give it a like to show your appreciation!

Thank you for contributing to our amazing Power BI community! 
SachinNandanwar
Solution Specialist
Solution Specialist

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.