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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
JPScotland
Helper I
Helper I

Difference between datetime column and end of the same day

I have a datetime column but what I want to do is something like this

 

 

 

DATEDIFF ( datetime, SAMEDAY@ 23:59:59), MINUTE

 

 

 

I cant seem to find a way of working out the end of day using the date from the datetime column.  

 

Cheers,

JP

 

1 ACCEPTED SOLUTION
JPScotland
Helper I
Helper I

so I got there in the end.   Not ideal but works.  

 

So in my date table i created a column that gives you the end time of each day 

End of Working Day = 
                        'Date'[Date] + TIME (23,59,59)

 

So now I can do a quick lookup to find the end if the day in questions and them work out the difference between the 2.  NOTE: you will need a column in your table that shows just the date without the time.  This is what you use to search the date table. 

 

 DATEDIFF(
             Repairs[Main_Date/Time], 
             LOOKUPVALUE('Date'[End of Working Day], 'Date'[Date], Repairs[Main_Date (Date Only)]), 
              MINUTE)

 

Cheers.

View solution in original post

3 REPLIES 3
JPScotland
Helper I
Helper I

so I got there in the end.   Not ideal but works.  

 

So in my date table i created a column that gives you the end time of each day 

End of Working Day = 
                        'Date'[Date] + TIME (23,59,59)

 

So now I can do a quick lookup to find the end if the day in questions and them work out the difference between the 2.  NOTE: you will need a column in your table that shows just the date without the time.  This is what you use to search the date table. 

 

 DATEDIFF(
             Repairs[Main_Date/Time], 
             LOOKUPVALUE('Date'[End of Working Day], 'Date'[Date], Repairs[Main_Date (Date Only)]), 
              MINUTE)

 

Cheers.

Samarth_18
Community Champion
Community Champion

Hi @JPScotland ,

 

If I took your question correctly then required code would be like below:-

DATEDIFF ( datetime, today(), MINUTE)

 

BR,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hey Samarth,

 

Sorry, I need to be the end of the day on the same date specified by the datetime column.  

 

So if it was 16/05/2022 10:34:05, I would be looking to return 16/05/2022 23:59:59

 

Cheers,  

JP

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.