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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ryher
Microsoft Employee
Microsoft Employee

Summing Hourly Data from One Table with a Fixed Hour Block

Hi all,

 

I am trying to aggregate impressions from an hourly table (left table), into a time block table (right table).

 

Essentially, I want to total the hourly data into the time blocks from the From Hour - To Hour columns.

 

Many thanks for all the help!

 

ryher_0-1670015853927.png

 

4 REPLIES 4
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

ryher
Microsoft Employee
Microsoft Employee

Hi,

The WeTransfer link to the sample data is here: https://we.tl/t-NDtWQ0vuaH

In one table, we have impressions broken down by the individual hour, but I'd like to group them up into their own time blocks.

For example, on Fridays, hours 0 = 108 impr, hours 1 = 126, and hours 2 = 125 in one table.

In another table, I have a "From Hour" and "To Hour" columns.
So the results for an "From Hour" = 0 and "To Hour" = 2 would say 359 impressions (108+126+125).

The two tables are linked by campaign name/campaign ID.

Happy to share any additional details.


ryher_0-1670279747228.png

 

You have provided a little too much detail. Can you please indicate which two tables you mean?

The two tables are linked by campaign name/campaign ID.

Side note: you will want to do is to adjust your data model

lbendlin_0-1670286991772.png

Please identify which tables are facts and which are dimensions. Please do not use bidirectional search unless there is a dire need for it.

ryher
Microsoft Employee
Microsoft Employee

The two tables are the (BAM - Campaign Target Import) table and the (UI - Ad Group by Hour) table.
Is it possible to have a measure that returns a table of numbers between two numbers back?
Like From 0hr - 2hr returns [0,1,2].
With those numbers, I can sum the impressions across those hours (hour 0 + hour 1 + hour 2).

A new WeTransfer link has been created with the updated table names & relationships: https://we.tl/t-nD5ekyhbFG

Eventually, I would like for the (BAM - Ad Group Target Import) table to talk back with the (UI - Ad Group by Hour) table, but I expect the logic for the (BAM - Campaign Target Import) table can be used for the (BAM - Ad Group Target Import) table.

Feel free to delete/unlink the (Campaign Key), (Ad Group Key), and (Hour of Day Key) tables - those were made to help the BAM tables talk to the (Ad Group by Hour) table, but I'm open to a better way to have those table talk directly to each other.

ryher_0-1670365206233.png

 



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.