Forum Discussion

theBlessedCobba's avatar
theBlessedCobba
Frequent Visitor
1 year ago
Solved

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 ye...
  • MattiaFratello's avatar
    1 year ago

    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