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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Nick1810
Frequent Visitor

Quantity of Worked Days per Month

Hi, i have 2 tables. One is the history of services a technician did and a Calendar Table which links the Date in the Technician Services Table.

This is the structure

Nick1810_0-1654029431196.png

 

This is the date of the Services Table (the date is in format dd/mm/yyyy)

 

Service IDService DateTechnician
101/03/2022John
205/03/2022John
305/03/2022John
420/03/2022John
502/04/2022John
603/04/2022John
715/04/2022John
815/04/2022John
925/04/2022John
1025/04/2022John
1125/04/2022John
1201/03/2022Bob
1304/03/2022Bob
1404/03/2022Bob
1509/03/2022Bob
1609/03/2022Bob
1721/03/2022Bob
1802/04/2022Bob
1915/04/2022Bob
2015/04/2022Bob
2126/04/2022Bob
2226/04/2022Bob
2326/04/2022Bob

 

What I need is to know the quantity of days per month per technician that effectively worked. The values in bold red are the ones I need to obtain (Q Worked Days)

 

 MarchMarchAprilApril
TechnicianQ ServicesQ Worked DaysQ ServicesQ Worked Days
Bob6463
John4374

 

Thanks!

 

Nicolás.

1 ACCEPTED SOLUTION

Hi @Nick1810 ,

 

You can try distinctcount function to count the working days for each people.

Measure:

Q Services = CALCULATE(COUNT(Services[Service Date]))
Q Worked Days = CALCULATE(DISTINCTCOUNT(Services[Service Date]))

Result is as below.

RicoZhou_0-1654234567248.png

 

Best Regards,
Rico Zhou

 

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
amitchandak
Super User
Super User

@Nick1810 , what do you mean by effective here?

 

You can use count(Table[Service ID] )

 

or

countrows(summarize(Table, Table[Service Date]) )

 

 

Or you can filter for work day

example

measure =

calculate(count(Table[Service ID] ), filter(Date, weekday(Date[Date],2) < 6 ) )

 

Hi @amitchandak ,

 

By effective I mean how many days I technician worked despite how many services he did in one day.

 

I made a measure to count how many services a technician did, like the example you gave me, and that is how a got that Bob did 6 services in march and 6 in april, while John did 4 in march and 7 in april. I can calculate that.

 

But what I need to obtain is how many days each one worked in a month. If, for example, Bob did 5 services in 1 day, I want the measure to count 1. 

Taking into account the example data I posted, Bob worked 4 days in March and 3 in April, while John worked 3 days in March and 4 in April. This is the data i want to calculate by a measure.

 

Thanks.

Hi @Nick1810 ,

 

You can try distinctcount function to count the working days for each people.

Measure:

Q Services = CALCULATE(COUNT(Services[Service Date]))
Q Worked Days = CALCULATE(DISTINCTCOUNT(Services[Service Date]))

Result is as below.

RicoZhou_0-1654234567248.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-rzhou-msft ,

 

Yes, that worked! I was making it so complicated that wasn´t working. The thing I notice is that to work i don´t have to use Services[Service Date].DATE, but only Services[Service Date].

 

Many thanks!

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors