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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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