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! Request now

Reply
hermanjb
New Member

Create a measure that applies a calculation, but only to selected item in slicer

I'm trying to create a measure that adds "+2" to a sum (PRODUCTS[SALES]). But I only want to add the +2 to the values selected, e.g. I select product "Product 1" in the slicer, I add +2, but for all the other products the sales value remain the same. I have created a measure:

Sales plus =
VAR SalesScenario =
    SUMX (
        Products,
        Products[Sales] + 2
    )

RETURN
CALCULATE (
    SalesScenario,
        ALLSELECTED (Products[ProductNames] )
    )

But this measure applies the +2 to sales for all products. What am I doing wrong? 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @hermanjb,

I'd like to suggest you create a variable to store the calculation result and write an if statement to check the variable that not equal to blank, then you can add '+2' on the match condition records.

Sales plus =
VAR result =
    CALCULATE (
        SUM ( Products[Sales] ),
        ALLSELECTED ( Products ),
        VALUES ( Products[ProductNames] )
    )
RETURN
    IF ( result <> BLANK () , result + 2 )

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @hermanjb,

I'd like to suggest you create a variable to store the calculation result and write an if statement to check the variable that not equal to blank, then you can add '+2' on the match condition records.

Sales plus =
VAR result =
    CALCULATE (
        SUM ( Products[Sales] ),
        ALLSELECTED ( Products ),
        VALUES ( Products[ProductNames] )
    )
RETURN
    IF ( result <> BLANK () , result + 2 )

Regards,

Xiaoxin Sheng

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.

Top Solution Authors
Top Kudoed Authors