Reply
georgec96
Helper II
Helper II

Group data and sum by time frame ( last 8 hours, last 24 hours, last 48 hours and last 7 days)

Hi All,

 

I have the following dataset and i would like to create 4 measures to get the total quantity per last 8 hours, total quantity per last 24 hours, total quantity per last 48 hours and total quantity per last 7 days.

 

DateTimeQuantity
19/06/2022 14:12 280
19/06/2022 14:11280
19/06/2022 14:09280
19/06/2022 14:11280
19/06/2022 14:09280
19/06/2022 14:12280
19/06/2022 14:29224
19/06/2022 14:29224
19/06/2022 14:3280
19/06/2022 14:2280
19/06/2022 14:2280
19/06/2022 14:3280

 

I am not exactly sure what to specify in the SUMMARIZE () function to be able to group my data based on the above time frames.

 

Thank you in advance.

1 ACCEPTED SOLUTION
speedramps
Community Champion
Community Champion

 

Click here to download a solution 

 

Look at the measures

 

Nowdatetime gets the date and time of the last record.

Change this to your system time if required.

 

8 hoursago, 24hours ago, 48hours ago and 7days ago get the correct datetime

but subtracting TIME value from Nowdatetime

 

Qty in period calculates the sum of the quantity >= the selected period

 

 

Thanks for reaching out for help.

I have helped you, now please help me by giving kudos.

Remeber we are unpaid volunteers.

Click the thumbs up and accept as solution button. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you !

 

 

View solution in original post

3 REPLIES 3
speedramps
Community Champion
Community Champion

 

Click here to download a solution 

 

Look at the measures

 

Nowdatetime gets the date and time of the last record.

Change this to your system time if required.

 

8 hoursago, 24hours ago, 48hours ago and 7days ago get the correct datetime

but subtracting TIME value from Nowdatetime

 

Qty in period calculates the sum of the quantity >= the selected period

 

 

Thanks for reaching out for help.

I have helped you, now please help me by giving kudos.

Remeber we are unpaid volunteers.

Click the thumbs up and accept as solution button. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you !

 

 

@speedramps  Thank you! Exactly what I needed.

 

 

Thank you, I loved the date time DAX questions. Glad my solution helped you.

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)