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! Learn more

Reply
theBlessedCobba
Frequent Visitor

Ticket Data Average per hour by weekday

I am trying to create a table that shows me the average count of tickets per hour by week day and im struggling 

I have a full years worth of data and the question i want to answer is, across the year what is the average amount of tickets i get between 10-11am on a tuesday (as an example)


This is some of the dataset (there is a bunch more columns that can be used) 

theBlessedCobba_0-1755674649850.png

 

The result i am looking for is 

 MONTUESWEDTHUFRI
      
1am 22211
2am22211
3am33322
4am44466
5am55533
6am66644
7am2020201010
8am5050503030


with all values representing the average across the 12 months of that time on that day of the week 

 

Thanks in advance! !

1 ACCEPTED SOLUTION
MattiaFratello
Super User
Super User

Hi @theBlessedCobba,

 

Extract the weekday and hour from your timestamp column.

Group data by weekday and hour.

Count the number of tickets in each group for each day.

Calculate the average count per hour per weekday over the entire year (or 12 months).

 

Hour = HOUR('Tickets'[ticket_time])

Weekday = FORMAT('Tickets'[ticket_time], "dddd") -- Full weekday name

TicketsPerHour = COUNT('Tickets'[ticket_id])

 

DailyHourCounts =
SUMMARIZE(
'Tickets',
'Tickets'[Date], -- assuming you have a Date column or create one with DATE('ticket_time')
'Tickets'[Hour],
'Tickets'[Weekday],
"CountTickets", COUNTROWS('Tickets')
)

 

AverageTicketsPerHour =
AVERAGEX(
FILTER(
DailyHourCounts,
DailyHourCounts[Hour] = SELECTEDVALUE('Tickets'[Hour]) &&
DailyHourCounts[Weekday] = SELECTEDVALUE('Tickets'[Weekday])
),
DailyHourCounts[CountTickets]
)


Create a matrix visual in Power BI:

Rows: Hour

Columns: Weekday

Values: AverageTicketsPerHour measure

View solution in original post

13 REPLIES 13
theBlessedCobba
Frequent Visitor

Hi @MattiaFratello or @Shahid12523 

One thing i have noticed is if there is hour blocks where on mulitple weeks there is 0 tickets (eg 1am) then say once per month there will be 1 ticket, because the data set doesnt have the hour groups with the ticketcount of 0 in it, the avg shows >1 when really it should be 0.2 

Is there any way to cater for this? 

Hi @theBlessedCobba, basically you want to have rows also for when ticket is = 0, correct?

I am finding without those, i dont get a true average of that time window. 

Then basically you just need create the groups also for the zeros as well

 

I think it's better to create a calendar table with all possible combinations

Calendar =
GENERATE(
CALENDAR(MIN('Tickets'[ticket_time]), MAX('Tickets'[ticket_time])),
ADDCOLUMNS(
SELECTCOLUMNS(GENERATESERIES(0, 23, 1), "Hour", [Value]),
"Weekday", FORMAT([Date], "dddd")
)
)

 

And then you can count using your ticket table

TicketsPerHour = CALCULATE( COUNTROWS('Tickets'), FILTER( 'Tickets', HOUR('Tickets'[ticket_time]) = Calendar[Hour] && 'Tickets'[Date] = Calendar[Date] ) )

 

AverageTicketsPerHour = AVERAGEX( FILTER( Calendar, Calendar[Hour] = SELECTEDVALUE(Calendar[Hour]) && Calendar[Weekday] = SELECTEDVALUE(Calendar[Weekday]) ), [TicketsPerHour] )

I haven't tested it tho, I have no time rn, please give it a try and adjust it accordingly

The ticketsPerhour measure doesnt allow for me to call the calender table in the filter for some reason

Do you have a relationship btw the two tables?

There was a relationship but it didnt seem to work, 

i ended up using all the stuff that you gave me and ran it through an LLM a few times til i got the required result, really appreciate you help 

Shahid12523
Community Champion
Community Champion

Create Hour and Day columns from [opend].

Measure to count tickets:

 

Ticket Count = COUNTROWS('Tickets')

 

Measure for average across weeks/months:

 

Avg Tickets =
AVERAGEX(
SUMMARIZE(
'Tickets',
'Tickets'[Year],
'Tickets'[Week Number],
'Tickets'[Day],
'Tickets'[Hour],
"TicketsPerSlot", [Ticket Count]
),
[TicketsPerSlot]
)

 

 

Use a Matrix:
Rows → Hour
Columns → Day
Values → [Avg Tickets]

 

Shahed Shaikh
MattiaFratello
Super User
Super User

Hi @theBlessedCobba,

 

Extract the weekday and hour from your timestamp column.

Group data by weekday and hour.

Count the number of tickets in each group for each day.

Calculate the average count per hour per weekday over the entire year (or 12 months).

 

Hour = HOUR('Tickets'[ticket_time])

Weekday = FORMAT('Tickets'[ticket_time], "dddd") -- Full weekday name

TicketsPerHour = COUNT('Tickets'[ticket_id])

 

DailyHourCounts =
SUMMARIZE(
'Tickets',
'Tickets'[Date], -- assuming you have a Date column or create one with DATE('ticket_time')
'Tickets'[Hour],
'Tickets'[Weekday],
"CountTickets", COUNTROWS('Tickets')
)

 

AverageTicketsPerHour =
AVERAGEX(
FILTER(
DailyHourCounts,
DailyHourCounts[Hour] = SELECTEDVALUE('Tickets'[Hour]) &&
DailyHourCounts[Weekday] = SELECTEDVALUE('Tickets'[Weekday])
),
DailyHourCounts[CountTickets]
)


Create a matrix visual in Power BI:

Rows: Hour

Columns: Weekday

Values: AverageTicketsPerHour measure

One last Question, 

 

Is there a way for the data to be sorted Mon > Sun? i cant seem to get it to work 

theBlessedCobba_0-1755745305687.png

 



Hey @theBlessedCobba,

 

Create a Sort Table, for example

Day Name Day Order
Monday     1
Tuesday     2
Wed          3
....

 

Click on your Sort Table column Day Name and sort it using Day Order


Connect this table to your other table with a relationship

 

Use Day Name from your Sort Table in the final visualization

 

Thank you!

This worked!!! thanks a lot 

I guess i need to go manually validate its giving me the right answer but it looks correct 
Ill mark it as accepted solution once i validate 

Appreciate it

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