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

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

Reply
Anonymous
Not applicable

Calculate the Subtract values based on the slicer value you have chosen

Dear all 

I have two slicers, continent and countries y, 

in the countries table, we have countries and items and profit 

I want to be able to choose two countries and see the Absolute Subtraction value between all the items within the 2 countries that I chosed

As default, Power BI is showing the SUM.  

Hadi2021_0-1663241264180.png

Hadi2021_1-1663241303828.png

The value in the visual should represent the subtraction of different products in Germany and Sweden. 

 

Thanks in advance 

Regards 

 

 

 

 

 

1 ACCEPTED SOLUTION

@Anonymous 
One way of doing that

=
VAR T1 =
    ADDCOLUMNS (
        VALUES ( 'Table'[Country] ),
        "@Value", CALCULATE ( SUM ( 'Table'[Value] ) )
    )
VAR MaxValue =
    MAXX ( T1, [@Value] )
VAR MinValue =
    MINX ( T1, [@Value] )
RETURN
    MaxValue - MinValue

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

@Anonymous 

What if you select 3 or more or even 1 what should be the expected result?

Anonymous
Not applicable

we could either limit the countries' slicer to choose only 2 ( I don't know how to do that 🙂 ) or continue subtracting from the final abstract result 

@Anonymous 
One way of doing that

=
VAR T1 =
    ADDCOLUMNS (
        VALUES ( 'Table'[Country] ),
        "@Value", CALCULATE ( SUM ( 'Table'[Value] ) )
    )
VAR MaxValue =
    MAXX ( T1, [@Value] )
VAR MinValue =
    MINX ( T1, [@Value] )
RETURN
    MaxValue - MinValue
Anonymous
Not applicable

It works great 

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.