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
Kassie72
Frequent Visitor

How to make a correct total when I have assigned a different value to negative values

Hi,

 

I have created a column 'Available hours' for my employees. However due to some circumstances (someone has taken vacation, while being sick at the same time) I get a negative value for one of the staff members:

 

Kassie72_0-1742920141609.png

I would like to obtain the result in the last column. So I have created the following measure:

if ([Available Hours] > 0, [Available Hours], (BLANK()))

However when I apply this measure, then I will get the field displayed correctly on row level, but with 68 as the total number of hours. I would like to have 108 as the answer.

What to do?
1 ACCEPTED SOLUTION
Deku
Super User
Super User

Sumx(

Values(table[employee]),

If( table[available hours] >0, table[available hours] )

)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

4 REPLIES 4
Kassie72
Frequent Visitor

Thank you for your quick answer. I realize that I have not been particular enough.

Available hours is a result of multiple measures.
[Capacity] - [Vacation] - [Sick days] = Available Hours
Vacation and Sick days originate from the same table, Capacity is in a separate table.

When I apply if ([Available Hours] > 0[Available Hours], (BLANK())) then the correct row result is displayed. However the total Available Hours still takes into account the negative value of -40. 

 

How can I avoid this?

 

Hi,

Try this measure

Measure = SUMX(values('Employee'[Employee]),[available hours])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

You need to use SUMX to interate each row like you have in your table, calcualting [Available Hours] for each row. You can perform the if > 0 within the iteration to exclude the negative numbers


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Deku
Super User
Super User

Sumx(

Values(table[employee]),

If( table[available hours] >0, table[available hours] )

)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors