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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kdunaev
Regular Visitor

Help with aggregation

Hello! I am new on here - first post!!

I have a measure calculated as: Missed Meal Hrs = count('Final Data'[Employee ID])*.5

I am trying to create another measure that would take a min value of the above measure and another value:

Missed Meal OT = min(sum('my data'[Overtime Hours]),[Missed Meal Hrs])

the structure of my data is such that for each [Employee ID] I have multiple rows. then all Employee IDs can be grouped into areas. When I look at my data as a table where each row is an Employee ID - the 2 formulas above calculate correctly. But when I take Employee IDs out of the table, and each row is now an Area - the Missed Meal OT formula does not aggregate at the Employee ID level, and tries to just use the totals of each area, which is not what I want. Any help would be greatly appreciated!

5 REPLIES 5
amitchandak
Super User
Super User

@kdunaev ,Can you share sample data and sample output.

For some reason, I'm having a hard time with copying a table into the body of the comment and don't see how to attach a file. Hopefully this link works:

 

https://www.dropbox.com/s/atwxz9wezhz1tna/Book1.xlsx?dl=0

 

 

Division

Employee IDMissed Meal HrsOT HoursMissed Meal OT hours
AA123452.500
AA123462.500
AA123472.50.220.22
AA123482.59.922.5
AA123492.52.182.18
AA123502.50.050.05
BB123512.52.932.5
BB123522.500
BB123532.50.60.6
BB123542.53.752.5
BB123552.54.822.5
BB123562.50.150.15

 

 

Desired outputMissed Meal HrsOT HoursMissed Meal OT hours
AA total15.0012.374.95
BB Total15.0012.258.25

 

 

What I am getting:Missed Meal HrsOT HoursMissed Meal OT hours
AA total15.0012.3712.37
BB Total15.0012.2512.25

Hi @kdunaev ,

 

You can use the below measures.

 

Missed Meal OT Hr = CALCULATE(SUM(Table5[Missed Meal OT hours]), ALLEXCEPT(Table5,Table5[Division]))
 
Missed Meal = CALCULATE(SUM(Table5[Missed Meal Hrs]), ALLEXCEPT(Table5,Table5[Division]))
 
OT Hourss = CALCULATE(SUM(Table5[OT Hours]), ALLEXCEPT(Table5,Table5[Division]))
2.JPG
 
 
Regrards,
Harsh Nathani
 
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors