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
bpopp
Frequent Visitor

Using Calendar Table to Count Hourly Transactions (without missing hours)

I'm sure this is a common problem, but I've searched in vain for several hours. I have a calendar table and a transaction table. Each transaction has a calculated datetime for the start of the hour (ie. 3/4/2017 03:00:00) and this is related to a calendar table containing a datetime calculation for each of the 24hours in each day. I created an inactive relationship (Actual On Hour) tying the two tables together and used a measure to count the related records:

 

Actual Flights Per Hour = Calculate(COUNTROWS('Flights'),USERELATIONSHIP(Flights[Actual On Hour],'Calendar'[DateTime]))

 

This works fine:

 

2018-08-14 09_59_33-impact - Power BI Desktop.png

 

but the problem is that I'm only getting records when there are matches. What I would like to see is every hour of every day, with zero's for the records where there are no relationships. Also, is there a way to do this without creating a relationship? I have four different dates and would prefer to not have to build inactive relationships for each.

 

Thanks so much,

 

bpopp

1 ACCEPTED SOLUTION

Hi @bpopp,

 

You can enable the option "Show items with no data" for the date column that is added to Matrix row.

1.PNG

 

Also, make a little adjustment to your original formula:

Actual Flights Per Hour =
CALCULATE (
    COUNTROWS ( 'Flights' ),
    USERELATIONSHIP ( Flights[Actual On Hour], 'Calendar'[DateTime] )
)
    + 0

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @bpopp,

What I would like to see is every hour of every day, with zero's for the records where there are no relationships. 

 

What do you mean "with zero's for the records"? How are these records look like? Please provide sample data of 'Flights' table to better describe your scenario.

How to Get Your Question Answered Quickly

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

In the example above, there were no matches for 8/13 2:00, so it just skipped it and went to 8/13 3:00. What I want is for it to include 8/13 2:00 with the count for that hour set to zero. 

Hi @bpopp,

 

You can enable the option "Show items with no data" for the date column that is added to Matrix row.

1.PNG

 

Also, make a little adjustment to your original formula:

Actual Flights Per Hour =
CALCULATE (
    COUNTROWS ( 'Flights' ),
    USERELATIONSHIP ( Flights[Actual On Hour], 'Calendar'[DateTime] )
)
    + 0

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I must have seen that a million times and just didn't notice it. Thanks for the help.

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