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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
runemalo
Frequent Visitor

Loop through rows with max value

Hi all,

 

I am trying to have a measure that is calculating the sum of FTE's like in the picture below. The problem is that each person can not be measured as more than one FTE, but can be less. The measure for FTE should be something like
SUM(IF("Hours sold" / "Normal Hours" > 1 , 1 , "Hours sold"/"Normal Hours"), except that is needs to do this for each person and not for the total dataset.. Anyone have a good solution?

 

How it currently works:

 

PersonHours SoldNormal HoursFTE
110038001,25
26008000,75
37608000,95
410088001,26
511338001,42
   5,63

 

How I want it:

 

PersonHours SoldNormal HoursFTE
110038001,00
26008000,75
37608000,95
410088001,00
511338001,00
   4,7

 

PS: The calculation is a bit more complex than above because there is also timing to be considered, hence I can't get calculated columns to work on this

 

Thank you in advance!

2 REPLIES 2
iamprajot
Responsive Resident
Responsive Resident

Here is the Calculated Column not according to the Person Column

Column = IF(Table1[Hours Sold]/Table1[Normal Hours]>1,1,Table1[Hours Sold]/Table1[Normal Hours])

&

Here is the Measure according to the Person Column

Measure = CALCULATE(IF(SUM(Table1[Hours Sold])/SUM(Table1[Normal Hours])>1,1,SUM(Table1[Hours Sold])/SUM(Table1[Normal Hours])),ALLEXCEPT(Table1,Table1[Person]))

Capture.JPG

Hi @iamprajot,

 

Thank you for your response. Unfortunately, it doesn't quite solve it. We need the filtering to be on each person as well. Additionally, there is time to consider here, as the calculation consists of multiple rows within a time frame (adding up to the rows in the example I provided above). Your measure below looks correct, except that the total row should add up to 4.7 and not 1.

 

I'm trying to think how to better explain it. In R or other programming languages I would have written a lapply or for loop checking for each person in the timeframe given, sum up all sold hours and divide by the expected number (normal hours). If that number is above 1, then 1, ifelse use the calculated number.

 

Last we want to sum all of these to get the total number of FTE.

 

Any suggestions?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.

Top Solution Authors