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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
jacosmit
Regular Visitor

Access control reports

Would dearly appreciate a set of fresh eyes.

I've been tasked with building a report that provides some insights as based on data from an access control db (sample data attached) The idea is to provide monthly reports that would be provided to the divisions that would highlights key stats.

These include:

 

1- List of staff per division that spent most time on site during the month (top 10)

2- List of staff per division that spent the least amount of time on site during the month (bottom 10)

 

My thought process was to create measures that would

1) Write earliest time per day per employee into new column

2) Write latest time per day per employee into another new column

3) Minus latest time with earliest time in a third new column and rank to get top and bottom lists.

 

Problem is, when I work with "CALCULATE" I am getting unexpected results, especially when trying to apply multiple filters to the measure for example:

Earliest Time = CALCULATE(MINX(Query1,Query1[TIME]),ALLEXCEPT(Query1,Query1[USER_ID],Query1[DATE].[Day]))
 
There has to be a better way to go about this!?
 
DATETIMETERMINALDIVISIONUSER_ID
Friday, 02 November 201806:32:34Staff Boom INDivision 01Joe Soap
Friday, 02 November 201806:33:07Boom Basement EntDivision 01Joe Soap
Friday, 02 November 201806:34:20Basement LobbyDivision 01Joe Soap
Friday, 02 November 201806:35:333rd Floor NorthDivision 01Joe Soap
Friday, 02 November 201807:03:453rd Floor NorthDivision 01Joe Soap
Friday, 02 November 201808:18:203rd Floor NorthDivision 01Joe Soap
Friday, 02 November 201808:43:59Visitor Boom INDivision 02Jan Niemand
Friday, 02 November 201808:44:30Staff Parking INDivision 02Jan Niemand
Friday, 02 November 201808:49:11Turnstile North 1 INDivision 02Jan Niemand
Friday, 02 November 201809:49:483rd Floor NorthDivision 01Joe Soap
Friday, 02 November 201809:52:083rd Floor NorthDivision 01Joe Soap
Friday, 02 November 201810:58:373rd Floor NorthDivision 01Joe Soap
Friday, 02 November 201812:32:183rd Floor NorthDivision 01Joe Soap
Friday, 02 November 201813:07:083rd Floor NorthDivision 01Joe Soap
Friday, 02 November 201813:34:59Turnstile North 1 OUTDivision 02Jan Niemand
Friday, 02 November 201813:38:49Staff Parking OUTDivision 02Jan Niemand
Friday, 02 November 201813:39:09Staff Boom OUTDivision 02Jan Niemand

 

5 REPLIES 5
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @jacosmit ,

What is your desired reuslt for your formula? Could you please post your desired result if possible?

 

Regards,
Daniel He

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

Hi Daniel

 

Something similar to the attached, per division.

MONTHDIVISIONUSER_IDTIME ON SITERANKING
Apr-19Division 01Joe Soap198:13:021
Apr-19Division 01Frank Noble198:11:002
Apr-19Division 01Stella Lange195:05:123
Apr-19Division 01Frank Niemand185:00:234
Apr-19Division 01Terry Crews156:00:155
Apr-19Division 01Tom Cruise154:00:146
Apr-19Division 01Rob Nelson150:10:157
Apr-19Division 01Ted Mosley149:02:458
Apr-19Division 01Sean Els148:00:159
Apr-19Division 01Tom Brady147:15:3210

Hi @jacosmit ,

So could you mean the TIME ON SITE and RANKING column is your desired column? How the logic about the TIME ON SITE column?

 

Regards,

Daniel He

 

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

Hi Daniel

 

Yes, TIME ON SITE and RANKING would be what is required as output.

Logic with regards to the TIME ON SITE...... Conceptually I wanted to work out the earliest and latest time per person per day. Then subtract latest with earliest to get to the amount of time spent on site per day. Then add all the daily totals to get to the monthly total.

Any ideas?

Helpful resources

Announcements
Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.