Forum Discussion
DAX measure If statement help
- Anonymous2 years ago
Hi rohitk1361 ,
Based on my testing, Removefilters function only clear filters from the specified tables or columns. Don’t clear the slicer selected value. Please try the following methods:
1.Create the sample table.
2.Drag the table scena column into the slicer visual.
3.Create the measure to calculate the values.
Measure = var _selected = SELECTEDVALUE('Table Scena'[Scenario]) var _scenario = SELECTEDVALUE('Table'[Scenario]) RETURN IF ( _scenario = _selected, CALCULATE( SUM('Table'[Amt]), 'Table'[Source] = "CY" // REMOVEFILTERS('Table Scena'[Scenario]) ), IF(LEFT(MAX('Table'[Year]), 4) = "2023", CALCULATE( SUM('Table'[Amt]), 'Table'[Source] = "ABC", REMOVEFILTERS('Table Scena') ) ) )4.Select the scenario in the slicer visual. The result is shown below.
You can also view the following link to learn more information.
REMOVEFILTERS function (DAX) - DAX | Microsoft Learn
Solved: DAX Measure ignore filter/slicer selection - Microsoft Fabric Community
ALL function (DAX) - DAX | Microsoft Learn
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi rohitk1361 ,
Based on my testing, Removefilters function only clear filters from the specified tables or columns. Don’t clear the slicer selected value. Please try the following methods:
1.Create the sample table.
2.Drag the table scena column into the slicer visual.
3.Create the measure to calculate the values.
Measure =
var _selected = SELECTEDVALUE('Table Scena'[Scenario])
var _scenario = SELECTEDVALUE('Table'[Scenario])
RETURN
IF (
_scenario = _selected,
CALCULATE(
SUM('Table'[Amt]),
'Table'[Source] = "CY"
// REMOVEFILTERS('Table Scena'[Scenario])
),
IF(LEFT(MAX('Table'[Year]), 4) = "2023",
CALCULATE(
SUM('Table'[Amt]),
'Table'[Source] = "ABC",
REMOVEFILTERS('Table Scena')
)
)
)
4.Select the scenario in the slicer visual. The result is shown below.
You can also view the following link to learn more information.
REMOVEFILTERS function (DAX) - DAX | Microsoft Learn
Solved: DAX Measure ignore filter/slicer selection - Microsoft Fabric Community
ALL function (DAX) - DAX | Microsoft Learn
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.