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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Direct Query Difference Between Date and Current/Local Time

Hi, All.

 

I am struggling to figure out how to get, in total hours, the difference between a start date column and the current/local time in Direct Query mode due to restrictions. I need the result to be in total decimal hours. Any thoughts or advice?

 

Thank you

1 ACCEPTED SOLUTION

Which source are you using? This measure worked with SQL Server.

 

TotalHrsFromNow =
SUMX ( DQDate, ( NOW () - DQDate[Date] ) / 24 )

 

Pat

Microsoft Employee

View solution in original post

4 REPLIES 4
vicky_
Super User
Super User

You can use a measure.

calculate your local time using NOW() + yourTimezoneOffset / 24
and take a look at the DATEDIFF() function.

Anonymous
Not applicable

DATEDIFF was my first stop but it's not supported while using direct query. Neither is creating a DateTime.LocalNow using query editor. I will keep trying with a measure and see what I can come up with. 

Which source are you using? This measure worked with SQL Server.

 

TotalHrsFromNow =
SUMX ( DQDate, ( NOW () - DQDate[Date] ) / 24 )

 

Pat

Microsoft Employee
Anonymous
Not applicable

Oracle, and the measure is working now. I must have been missing something at first. Thank you!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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