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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
LotteLaugesen
Helper V
Helper V

Calculation gets bad performance when I add -1

Hi

 

I have this calculation

CALCULATE(
DIVIDE(SUM(FT_ManufacturingOrderHeader[Manufactured Quantity KG]), SUM(FT_ManufacturingOrderHeader[Kg Fillets]))) 
that performs fine (<1 sek), but when I add -1 to it 
CALCULATE(
DIVIDE(SUM(FT_ManufacturingOrderHeader[Manufactured Quantity KG]), SUM(FT_ManufacturingOrderHeader[Kg Fillets]))) - 1
then it takes > 40 sek no matter if I put -1 inside or outside the parentheses.
 
Can anybody help?
 
1 ACCEPTED SOLUTION

Thank you, Owen, it works perfect and quick 😀

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @LotteLaugesen 

I'm assuming this is a measure.

You do have do watch out when adding a constant to a measure, as it means a value is returned for any combination of dimensions that might be included in a visual, potentially impacting performance.

 

Also, the outer CALCULATE is not needed if this is a measure.

 

I would try this:

VAR Ratio =
    DIVIDE (
        SUM ( FT_ManufacturingOrderHeader[Manufactured Quantity KG] ),
        SUM ( FT_ManufacturingOrderHeader[Kg Fillets] )
    )
RETURN
    IF ( NOT ISBLANK ( Ratio ), Ratio - 1 )

Alternatively, you could write this (should be equivalent):

VAR ManQtyKG =
    SUM ( FT_ManufacturingOrderHeader[Manufactured Quantity KG] )
VAR KGFillets =
    SUM ( FT_ManufacturingOrderHeader[Kg Fillets] )
RETURN
    DIVIDE ( ManQtyKG - KGFillets, KGFillets )

 Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Thank you, Owen, it works perfect and quick 😀

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.