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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
o59393
Post Prodigy
Post Prodigy

How to sum only negatives values from another measure

Hi all

 

I have a measure called "Delta Capacity & OU Demand" that calculates the difference between capacity & demand. Any negative value should be a lost in sales.

 

What I need is a measure that returns me the sum of those potential lost sales. The potential lost sales would be when demand is above capacity or in other words when the capacity saturation is >=100%

 

Here is the table sample. As seen below in only one month we have a saturation above 100% and it is in december 2028. The column of "delta capacity & OU demand " has a negative of 2.1 Million.

 

o59393_0-1696455823427.png

 

Therefore the "Potential lost sales" measure should only return the sum of the 2.1 million of lost sales.

 

I created the follwing measure:

 

 

Potential Lost Sales KO Demand = 

SUMX(
    SUMMARIZE(
        'SKU by line - Official',
        'SKU by line - Official'[Date],
        'SKU by line - Official'[Country Of Manufacturing],
        'SKU by line - Official'[Manufacturing plant of production],
        'SKU by line - Official'[Manufacturing line],
        'SKU by line - Official'[Package All]
    ),

IF([Saturation KO year 1]>=1,

[Delta Capacity & OU Demand],

0
)
)

 

 

The If basically says (or at least I want to have) is if the saturation on the given month is over 100% then sum the lost sales.

 

How ever the value i get is: 44 million. Too much!

 

Any idea how to get this work?


Thanks.

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@o59393 you can try this, might need further tweaking

 

Potential Lost Sales KO Demand = 
VAR __Table =
ADDCOLUMNS ( 
    SUMMARIZE(
        'SKU by line - Official',
        'SKU by line - Official'[Date] 
    ),
    "@Saturation KO", [Saturation KO year 1],
    "@Delta Capacity & OU Demand", [Delta Capacity & OU Demand]
)
RETURN
SUMX ( 
  FILTER( __Table, [@Saturation KO] > 1 ),
  [@Delta Capacity & OU Demand]
)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
AndreDeLange
Helper II
Helper II

It would help to get an idea of how your data model is structured and how the measure for [Delta Capacity & OU Demand] is defined. Assuming your main table is called 'SKU by line - Official' (replace if it's something else),

Have you considered this approach:
Potential Lost sales = calculate([Delta Capacity & OU Demand],Filter('SKU by line - Official',[Delta Capacity & OU Demand]<0))

hi @AndreDeLange 

 

I got it to work with Parry's approach.

 

Thanks for the help!

parry2k
Super User
Super User

@o59393 you can try this, might need further tweaking

 

Potential Lost Sales KO Demand = 
VAR __Table =
ADDCOLUMNS ( 
    SUMMARIZE(
        'SKU by line - Official',
        'SKU by line - Official'[Date] 
    ),
    "@Saturation KO", [Saturation KO year 1],
    "@Delta Capacity & OU Demand", [Delta Capacity & OU Demand]
)
RETURN
SUMX ( 
  FILTER( __Table, [@Saturation KO] > 1 ),
  [@Delta Capacity & OU Demand]
)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k  Mindblowing. 

 

Thanks a lot!

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.