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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
kylebi1
Frequent Visitor

Round Down to Nearest 30 Minute Interval (Query Editor)

Is there a way to add a custom column at the query level for rounding down to nearest 30 minute interval?

 

This is my current custom column outside of the query:

 

Interval = TIME(HOUR(v_nm_cic_eAgentActivityLog[event_time]), ROUNDDOWN((MINUTE(v_nm_cic_eAgentActivityLog[event_time])/60)*2, 0) * 30, 0)

 

I can't get this to be added at the query level, however. I need this to perform an inner merge on another table.

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @kylebi1,

 

It seems that your formula is written using the Dax function.

 

In Query Editor, you could create a custom column with the formula below which logic should be more easier.

 

Nearest 30 Minute Interval= Table.AddColumn(#"Changed Type", "Custom", each Time.From(Text.From(Time.Hour(Time.From([Time])))&":"&(if Time.Minute(Time.From([Time]))>= 30 then "30" else "0")&":00"))

Here is the output.

 

query editor.PNG

 

In addition, you also could have a reference of this video about Round time to nearest x min with Power Query.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @kylebi1,

 

It seems that your formula is written using the Dax function.

 

In Query Editor, you could create a custom column with the formula below which logic should be more easier.

 

Nearest 30 Minute Interval= Table.AddColumn(#"Changed Type", "Custom", each Time.From(Text.From(Time.Hour(Time.From([Time])))&":"&(if Time.Minute(Time.From([Time]))>= 30 then "30" else "0")&":00"))

Here is the output.

 

query editor.PNG

 

In addition, you also could have a reference of this video about Round time to nearest x min with Power Query.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you!!!!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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