I have 2 slicers which filter different values from a column named Scenario in the main table.
I’ve created 2 different tables, each with the values from the scenario table and other with sum:
CALCULATE(
SUM(2024_P13_POWERBI[Quantity]), FILTER(2024_P13_POWERBI, 2024_P13_POWERBI[Scenario] = SELECTEDVALUE(‘Scenario Selection2′[Scenario2]))
)
The issue is, I need a third card with the subtraction of 2 filters (selection 1 and 2) and it’s not working at all:
VAR SelectedScenario1 = SELECTEDVALUE(‘Scenario Selection1′[Scenario1])
VAR SelectedScenario2 = SELECTEDVALUE(‘Scenario Selection2′[Scenario2])
VAR Value1 =
IF (
ISBLANK(SelectedScenario1),
BLANK(),
CALCULATE(
SUM(2024_P13_POWERBI[Quantity]),
REMOVEFILTERS(‘Scenario Selection2′[Scenario2]),
2024_P13_POWERBI[Scenario] = SelectedScenario1
)
)
VAR Value2 =
IF (
ISBLANK(SelectedScenario2),
BLANK(),
CALCULATE(
SUM(2024_P13_POWERBI[Quantity]),
REMOVEFILTERS(‘Scenario Selection1′[Scenario1]),
2024_P13_POWERBI[Scenario] = SelectedScenario2
)
)
RETURN
IF(
ISBLANK(Value1) || ISBLANK(Value2),
BLANK(),
Value1 – Value2
)
But it returns blank.
I hope someone could help on this one. Thanks!
Rodrigo Miranda is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.