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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Desperately need help! Avg tickets for each hour for selected days of week in a selected date range

I have been trying every possible option for days now and I am just going around in circles.  I have a Date table, a Time table, and a data table. My data table contains one ticket per row with a timestamp.   I have broken out the time stamp into date, time, weekday and hour.  I have a day of week slicer that is connected to my date table ('Date'[Day of Week]) and a date slicer that is connected to my date table ('Date[MMYY]).
These are the measures that I am using: 
Total Tickets Countrows('Mytable')
Avg Per Day
AVERAGEX(DISTINCT('MyTable'[Date Created]),Calculate(Countrows('MyTable')/[Count Days]))

Count Days = DISTINCTCOUNT('MyTable'[Date Created])
Hourly Average = AVERAGEX(SUMMARIZE('MyTable', 'MyTable'[Hour],"Hourly Total",COUNTROWS('MyTable')),[Hourly Total])
 
The Hourly Average is where I am struggling.  The hourly average measure is actually giving me the totals per hour for the selected day where I need the hourly AVERAGE of tickets per hour of each day (for the slicer selected day(s) and Month(s).  
 
I tried Hourly Average = AVERAGEX(SUMMARIZE('MyTable', 'MyTable'[Hour],"Hourly Total",COUNTROWS('MyTable')),[Hourly Total])/[Count of Days] and that gives incorrect averages that do not add up. 
 
As a test, I tried manually adding in the count of days. and this works.  The averages per hour across the days is correct.   So All Saturday and Sundays in Jan, Feb, and March = 25. 
Hourly Average = AVERAGEX(SUMMARIZE('MyTable', 'MyTable'[Hour],"Hourly Total",COUNTROWS('MyTable')),[Hourly Total])/25. 
 
Here's what I get in excel and what I am expecting to see - Expected averages.JPG

How do I get this measure to work using the slicer selected days?
Power BI example.JPG
1 ACCEPTED SOLUTION
Anonymous
Not applicable

I finally got this to work!  Posting the solution here in case others have this issue.  At least this appears to function as expected. 

 

I changed the Count Days measure to be: 

Count of Days=CALCULATE(DISTINCTCOUNT('Date Created'[Date]),all('Date Created'[Date]))
 
Then my Per hour measure worked: 
AVERAGEX(SUMMARIZE('MyTable', 'MyTable'[Hour],"Hourly Total",COUNTROWS('MyTable')),[Hourly Total])/[Count of Days]
 
 
 

View solution in original post

3 REPLIES 3
upen
New Member

What is Hourly Total in your measure?

Is it count of hours or sum of hours?

tamerj1
Super User
Super User

Hi @Anonymous 

Please try

Hourly Average =
AVERAGEX (
    SUMMARIZE ( 'MyTable', 'MyTable'[Date Created], 'MyTable'[Hour] ),
    CALCULATE ( COUNTROWS ( 'MyTable' ) )
)
Anonymous
Not applicable

I finally got this to work!  Posting the solution here in case others have this issue.  At least this appears to function as expected. 

 

I changed the Count Days measure to be: 

Count of Days=CALCULATE(DISTINCTCOUNT('Date Created'[Date]),all('Date Created'[Date]))
 
Then my Per hour measure worked: 
AVERAGEX(SUMMARIZE('MyTable', 'MyTable'[Hour],"Hourly Total",COUNTROWS('MyTable')),[Hourly Total])/[Count of Days]
 
 
 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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