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

Creating Headcount by Minute

Hello all!

I am making a daily report for a short-term project that tracks (among other things) headcount in a secure area on a minute-by-basis, and I'm trying to create a line chart showing occupancy. 


I have 2 tables. One is a "Project Date/Time" table that includes every minute of a project, similar to this: 

kbryantUSL_0-1707939120328.png

The other is a trip log table that has columns for time in/out: 

kbryantUSL_1-1707939189580.png

 

I'm trying to create a new calculated table that has the DateTime minutes as rows, the trip IDs as columns, and a value of 1 for every minute between Time in/out. My plan is to then SUMX the table and make the vis based on that. Conceptually, it would look like this: 

kbryantUSL_2-1707939520880.png

I'm open to suggestions on alternate methods, but ultimately, I'll need a scalar/discrete number for each minute, as I'll need that value for some other metrics.

 

(If it helps, I'm recreating the logic from a Tableau report using this calc:  IF [DateTime] >= [Time In] AND [DateTime] < [Time Out] THEN 1 ELSE 0. I think this only worked because of how Tableau uses "Relationships" instead of Joins, but I'm at a loss as to how to recreate that here).

 

Thanks a million!!

2 REPLIES 2
mh2587
Super User
Super User

OccupancyMeasure = //Try this
SUMX (
    FILTER (
        'Trip Log',
        'Project Date/Time'[DateTime] >= 'Trip Log'[Time In]
        && 'Project Date/Time'[DateTime] < 'Trip Log'[Time Out]
    ),
    1
)

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Hi Muhammad - Thanks for your reply! 
This doesn't work for me - It can't reference the date/time column and I get this error: 
A single value for column 'DateTime' in table 'Project Date/Time' cannot be determined. This can happen when a measure formula refers to a column that contains many values

Is this due to the relationship? My tables have a straightforward 1:* join:

kbryantUSL_1-1707943809044.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.