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! Request now

Reply
Luggruff
Frequent Visitor

Count number of days where measure equals value

Hi!

 

I'm trying to create a visual calculating bonus per employee, and each employee can earn bonus every day their productivity reaches a certain goal. I'm struggling with getting the number of days that the employees reach that target.

 

I have a measure calculating productivity by cases per hour, and it simply takes the sum of cases split by their number of working hours.

 

When I use this in a matrix that has employee and date as rows, it shows the cases per hour per employee and day.

 

Now, I want to create a table where I only have the employee name as rows, and instead a measure that "simply" (not so simple apparently) gives me the number of days where the cases per hour measure for each employee reaches a certain number in the data that I have filtered (have a slicer for month for example that is based on my calendar table). But I cannot figure out what logic to use for this. 


My data:

 

  • Calendar DIM table
  • Employee DIM table with employee ID and name
  • FACT table with a column for handled cases, date and employee ID, although it has categories, so one employee might be listed multiple times per day. This is linked to the Calendar DIM table by the date column. It is also linked to the Employee DIM table by user ID in order to show users by name
  • FACT table with working seconds column, date column and employee ID column

My cases per hour measure (based on two other measures):

Cases per hour = DIVIDE([Total cases handled],[Total working hours])
 
[Total cases handled] measure:
 
Total cases handled = SUMX('fact_Cases','fact_Cases'[Cases handled]))
 
[Total working hours] measure:
Total working hours = CALCULATE(([Total working time (sec)]/60)/60)
 
[Total working time (sec)] measure:
Total working time (sec) = CALCULATE((SUM('fact_Working_Hours'[Total of actual working hours (net) [Min]]])*60))
 
Any suggestions?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Luggruff ,

I have created a simple sample, please refer to it to see if it helps you.

Create three measures.

workinghour = MAX('working hours'[Worked time (sec)])/60/60
Measure = var _1= MAX('fact'[Cases handled])/'working hours'[workinghour]
return
IF('working hours'[workinghour]=BLANK(),0,_1)
Measure 2 = var _1= COUNTAX(FILTER(ALL(Employee),Employee[Emplyee ID]=SELECTEDVALUE('fact'[Employee ID])&&[Measure]>=3.25),[Measure])
return
IF(_1=BLANK(),0,_1)

The relationship amont the tables like the following:

vpollymsft_0-1659073609231.png

vpollymsft_1-1659073626325.png

If I have misunderstood your meaning ,please provide more details with your desired output.

 

Best Regards
Community Support Team _ Polly

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

3 REPLIES 3
Anonymous
Not applicable

Hi @Luggruff ,

I have created a simple sample, please refer to it to see if it helps you.

Create three measures.

workinghour = MAX('working hours'[Worked time (sec)])/60/60
Measure = var _1= MAX('fact'[Cases handled])/'working hours'[workinghour]
return
IF('working hours'[workinghour]=BLANK(),0,_1)
Measure 2 = var _1= COUNTAX(FILTER(ALL(Employee),Employee[Emplyee ID]=SELECTEDVALUE('fact'[Employee ID])&&[Measure]>=3.25),[Measure])
return
IF(_1=BLANK(),0,_1)

The relationship amont the tables like the following:

vpollymsft_0-1659073609231.png

vpollymsft_1-1659073626325.png

If I have misunderstood your meaning ,please provide more details with your desired output.

 

Best Regards
Community Support Team _ Polly

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

vanessafvg
Super User
Super User

are you able to supply some sample data in text form with an example of your expected outcome





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Something like this:

 

dim_calendar:

 

DateMonth
2022-07-01Jul 2022
2022-07-02Jul 2022
2022-07-03Jul 2022
2022-07-04Jul 2022
2022-07-05Jul 2022
2022-07-06Jul 2022
2022-07-07Jul 2022
2022-07-08Jul 2022
2022-07-09Jul 2022
2022-07-10Jul 2022
2022-07-11Jul 2022
2022-07-12Jul 2022
2022-07-13Jul 2022
2022-07-14Jul 2022
2022-07-15Jul 2022
2022-07-16Jul 2022
2022-07-17Jul 2022
2022-07-18Jul 2022
2022-07-19Jul 2022
2022-07-20Jul 2022
2022-07-21Jul 2022
2022-07-22Jul 2022
2022-07-23Jul 2022
2022-07-24Jul 2022
2022-07-25Jul 2022
2022-07-26Jul 2022
2022-07-27Jul 2022
2022-07-28Jul 2022
2022-07-29Jul 2022
2022-07-30Jul 2022
2022-07-31Jul 2022

 

dim_employees:

Emplyee IDName
542524Employee A
542523Employee B


fact_cases:

 

DateEmployee IDCategoryCases handled
2022-07-15542524A25
2022-07-18542524A26
2022-07-25542524A12
2022-07-25542524B14
2022-07-14542523A10
2022-07-15542523A9
2022-07-15542523B15
2022-07-20542523A13

 

fact_Working Hours:

DateEmployee IDWorked time (sec)
2022-07-1454252428800
2022-07-1554252428800
2022-07-1554252328800
2022-07-1854252428800
2022-07-2054252328800

 

Then expected output visual table would be:

Employee nameDays with X cases per hour
Empolyee A1
Employee B0


..given that cases per hour target per day is 3.25 (so the days where Employee A reached 26 cases total in the 8 hours. 

Note: It cannot be the count of days with numbers split by the cases per hour or anything, as the bonus is based on individual days.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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