Forum Discussion
VinayakKarne
6 years agoFrequent 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...
- 6 years ago
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
select "Giver"select "Receiver"no value selectedselect both "Giver" and " Receiver"
and here is sample pbix file, please try it.
Regards,
Lin
v-lili6-msft
6 years agoCommunity 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
select "Giver"select "Receiver"no value selectedselect both "Giver" and " Receiver"
and here is sample pbix file, please try it.
Regards,
Lin