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
siva3012
Helper II
Helper II

Transform 15 mins interval data into 30 mins data.

Hi, 

        I want to convert the 15 mins interval data into 30 mins interval data. Can anyone guide me in doing this in PowerBI?  

I have the screenshot which is required. 


Untitled.jpg

 

 

 

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

A Power Query solution:

 

let
    Source = Data15Mins,
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Time", type number}}),
    #"Divided Column" = Table.TransformColumns(#"Changed Type", {{"Time", each Number.RoundDown(_ * 48, 0) / 48, type number}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Divided Column",{{"Time", type time}}),
    #"Inserted Merged Date and Time" = Table.AddColumn(#"Changed Type1", "Merged", each [Date] & [Time], type datetime),
    #"Grouped Rows" = Table.Group(#"Inserted Merged Date and Time", {"Merged"}, {{"Usage", each List.Sum([Usage]), type number}}),
    #"Inserted Time" = Table.AddColumn(#"Grouped Rows", "Time", each DateTime.Time([Merged]), type time),
    #"Extracted Date" = Table.TransformColumns(#"Inserted Time",{{"Merged", DateTime.Date}}),
    #"Reordered Columns" = Table.ReorderColumns(#"Extracted Date",{"Merged", "Time", "Usage"})
in
    #"Reordered Columns"
Specializing in Power Query Formula Language (M)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @MarcelBeug 

I appreciated this is an old thread, I am trying to apply your methodology in rounding time values to the nearest 8 hour interval. I am somewhat struggling to understand the functions within the below and how to amend this to achieve it. For example, It would be ideal if times between 00:00:00 - 07:59:59 were assigned to the 00:00:00 band, those between 08:00:00 - 15:59:59 in the 08:00:00 band and those 16:00:00 - 23:59:59 to the 16:00:00 band. 

 

For a different purpose, it would also be good for you to explain the calculation given within the first solution, so it could be modified to for example rounding to 1 hour, or 10 minute timeframes. 

 

Your response is appreciated. 

 

Regards,

MarcelBeug
Community Champion
Community Champion

A Power Query solution:

 

let
    Source = Data15Mins,
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Time", type number}}),
    #"Divided Column" = Table.TransformColumns(#"Changed Type", {{"Time", each Number.RoundDown(_ * 48, 0) / 48, type number}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Divided Column",{{"Time", type time}}),
    #"Inserted Merged Date and Time" = Table.AddColumn(#"Changed Type1", "Merged", each [Date] & [Time], type datetime),
    #"Grouped Rows" = Table.Group(#"Inserted Merged Date and Time", {"Merged"}, {{"Usage", each List.Sum([Usage]), type number}}),
    #"Inserted Time" = Table.AddColumn(#"Grouped Rows", "Time", each DateTime.Time([Merged]), type time),
    #"Extracted Date" = Table.TransformColumns(#"Inserted Time",{{"Merged", DateTime.Date}}),
    #"Reordered Columns" = Table.ReorderColumns(#"Extracted Date",{"Merged", "Time", "Usage"})
in
    #"Reordered Columns"
Specializing in Power Query Formula Language (M)

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.