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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

How to do a calculated measure based on count of rows?

Hi All,

 

I am stuck in a difficult problem. I am calculating the salary of employees into their full-time salary. However, I noticed that few employees have multiple rows if they worked for different departments and now their salary is being extrapolated as each row is being converted to full-time pay. For eg.

BIuser_4_2-1640618636762.png

 

In the image above, Full-time pay is a calculated measure =( 1.0 * Salary)/ Full-Time Equivalent. So employee 1 works only 0.75 but we are converting his salary to full-time salary for this analysis as if they worked 1.0 FTE.

 

But if we look at employee 2 & 3, they do work 1 FTE but they have seperate rows as they work for different departments. For eg, employee 2 full-time salary should only be 20,000 + 15,000=35,000, but full-time salary is converting their salary into full time salary 2 times as they have 2 rows of data. So their salary is being extrapolated than their actual full-time pay. How can I fix this in Power BI?

 

 

1 ACCEPTED SOLUTION

Hi, @Anonymous 

You can try formula as below:

Measure1 = 
CALCULATE (
    SUM ( 'Table'[Salary] ) / 1,  // or  SUM ( 'Table'[Salary] ) / SUM ( 'Table'[Full-Time Equivalent] ),
    ALLEXCEPT ( 'Table', 'Table'[Employee] )
)

76.png

 

Best Regards,
Community Support Team _ Eason

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try a measure like

divide( divide( ( 1.0 * [Salary]), [Full-Time Equivalent]), countrows(filter( allselected(Table), Table[employee] =max(Table[employee] ))))

 

 

or


sumx(values(Table[employee]) ,
divide( divide( ( 1.0 * [Salary]), [Full-Time Equivalent]), countrows(filter( allselected(Table), Table[employee] =max(Table[employee] ))))
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi,

 

Thanks for the quick solution. I have used this formula,

 divide( divide( ( 1.0 * [Salary]), [Full-Time Equivalent]), countrows(filter( allselected(Table), Table[employee] =max(Table[employee] ))))

 

However, now for the employees with multiple rows it is only showing the salary of 1st row. So in the example I gave, for employee 2 it is showing full-time pay as $20,000 instead of $35,000.

 

Is there any way to add the salaries of multiple rows to give the full-time pay?

Hi, @Anonymous 

You can try formula as below:

Measure1 = 
CALCULATE (
    SUM ( 'Table'[Salary] ) / 1,  // or  SUM ( 'Table'[Salary] ) / SUM ( 'Table'[Full-Time Equivalent] ),
    ALLEXCEPT ( 'Table', 'Table'[Employee] )
)

76.png

 

Best Regards,
Community Support Team _ Eason

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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