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
VinayakKarne
Frequent Visitor

When multiple values are selected in Filter, Add/Subtract values in the DataCards

Hi Team,

Need your opinion on below issue:

 

I have a filter "Transactions" which has two values:

1.Giver

2.Receiver

 

By default, when i select "Giver", i get sum value in the DataCard.

Same for the "Receiver".

 

Now what i want is when i select both "Giver" and " Receiver",  data card should provide me the value which is  ["Giver Record Values" - "Receiver Record Values"].

Also when there is no value selected, i want to show the sum of all the records.

 

I tried using "Calculated Column" where i marked "Receiver" values (-).  But when nothing is selected i get subtracted values.

How do i achieve this.

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @VinayakKarne 

For your case, just try this logic to create a measure

Measure = 
IF (
    ISFILTERED ( 'Table'[Type] ),
    IF (
        HASONEVALUE ( 'Table'[Type] ),
        CALCULATE ( SUM ( 'Table'[Value] ) ),
        CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Giver" )
            - CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Receiver" )
    ),
    CALCULATE ( SUM ( 'Table'[Value] ) )
)

Result:

Simple sample data

1.JPG

 

select "Giver"select "Giver"select "Receiver"select "Receiver"no value selectedno value selectedselect both "Giver" and " Receiver"select both "Giver" and " Receiver"

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi, @VinayakKarne 

For your case, just try this logic to create a measure

Measure = 
IF (
    ISFILTERED ( 'Table'[Type] ),
    IF (
        HASONEVALUE ( 'Table'[Type] ),
        CALCULATE ( SUM ( 'Table'[Value] ) ),
        CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Giver" )
            - CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Type] = "Receiver" )
    ),
    CALCULATE ( SUM ( 'Table'[Value] ) )
)

Result:

Simple sample data

1.JPG

 

select "Giver"select "Giver"select "Receiver"select "Receiver"no value selectedno value selectedselect both "Giver" and " Receiver"select both "Giver" and " Receiver"

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PattemManohar
Community Champion
Community Champion

@VinayakKarne  Please provide some sample test data and expected output which will be helpful to provide an accurate solution.

But by the look of it, you need to create a Measure not a calculated column. In the measure, use the selectedvalue to capture the filter selection.

 

Sample test data will be really helpful !





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.