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
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
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.