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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Kassie72
Regular 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
Community Champion
Community Champion

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
Regular 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/
Deku
Community Champion
Community Champion

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
Community Champion
Community Champion

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors