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
Gekko1
Helper I
Helper I

Get unique intervals from a column

So, my question is: I need to get the employees' worked hours from my company's call center. The thing is, a same employee can be in multiple calls simultaneously, however the calculated hours should be unique, for example: if the employee was in 2 calls; the first one began at 9:00 am and ended at 9:30 and the second one began at 9:00 am and ended at 9:20 am, the worked hours should be 30 minutes. The current dataset that I have is built in such way that if I just sum the durations of the calls I wouldnt get the actual worked hours due to some intervals being contained in larger intervals. How could I get through that?

EmployeesCall startCall end
Employee 108/08/2022 9:00 08/08/2022 9:40
Employee 108/08/2022 9:10 08/08/2022 9:30
Employee 2 08/08/2022 10:0008/08/2022 10:35
Employee 208/08/2022 10:1008/08/2022 10:20

 

In the example above, the employee 1 actually worked 40 minutes (duration of the biggest interval) and employee 2 worked 35 minutes.

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

@Gekko1 

 

Create a table where all the intervals are expanded into minutes throughout the day. Here's what such a table should look like:

 

EmployeeId | CallId | Date | MinuteId

----------------------------------------

 

Once you've got this, it's easy to calculate unique time. You can add as many attributes to the table as you need to track all necessary details. Your DAX for calculating the number of unique minutes will then be:

 

[# Minutes] = distinctcount( T[MinuteId] )

 

How easy is that, huh? Bear in mind, please, that MinuteId should be unique across all days. If you make it unique only throughout a day, you'll have a much harder time to calculate. I would suggest that you just number all the minutes consecutively starting from the beginning of your time.

View solution in original post

1 REPLY 1
daXtreme
Solution Sage
Solution Sage

@Gekko1 

 

Create a table where all the intervals are expanded into minutes throughout the day. Here's what such a table should look like:

 

EmployeeId | CallId | Date | MinuteId

----------------------------------------

 

Once you've got this, it's easy to calculate unique time. You can add as many attributes to the table as you need to track all necessary details. Your DAX for calculating the number of unique minutes will then be:

 

[# Minutes] = distinctcount( T[MinuteId] )

 

How easy is that, huh? Bear in mind, please, that MinuteId should be unique across all days. If you make it unique only throughout a day, you'll have a much harder time to calculate. I would suggest that you just number all the minutes consecutively starting from the beginning of your time.

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.