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

View all the Fabric Data Days sessions on demand. View schedule

Reply
MuradMusleh
Frequent Visitor

How to get the total of negative values of categories?

Hi everyone, 
I have more than 4 measures to calculate the loss time hours. I need to show the total of category only if the total of segment is negative. The total of segment is calculated based on products regardless of their value if it is positive or negative. All what I care about is if the total of segment is negative so it should be added to other subtotals of the category. 

In the attached image, you can find the grand total is 52.57 but the correct one that is needed is 8.63 only because the other subtotal of segment 2 and 3 are positive.

 


Power BI.png

1 ACCEPTED SOLUTION
MuradMusleh
Frequent Visitor

Thanks everyone
After a while of work, I found the solution


EEE =

VAR Neg_Value =  CALCULATE([Loss Time (HR)]FILTERVALUES 'TableName' [Segment] ) , [Loss Time (HR)] ) )
 
RETURN
 
Neg_Value

MuradMusleh_1-1658516268050.png

 


The grand total sum and shows only the sum of negative subgrand total only.

 

View solution in original post

4 REPLIES 4
MuradMusleh
Frequent Visitor

Thanks everyone
After a while of work, I found the solution


EEE =

VAR Neg_Value =  CALCULATE([Loss Time (HR)]FILTERVALUES 'TableName' [Segment] ) , [Loss Time (HR)] ) )
 
RETURN
 
Neg_Value

MuradMusleh_1-1658516268050.png

 


The grand total sum and shows only the sum of negative subgrand total only.

 

MuradMusleh
Frequent Visitor

Thanks for your reply. 
All what I need is to sum the negative subtotals only and omit the positive values.

If your Loss time is a meausre

Sumx(

    values([Plants)],

    if(

        [measuer]<0,

        calculate([measuer]),

        0

    )

)

vapid128
Solution Specialist
Solution Specialist

I don think you need add all negative numbers.

 

I would do:

Sumx(values([Plants)],calculate(max([measuer],0)))

 

that will show no negative numbers.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.