Forum Discussion
anthonjhnon1
5 months agoRegular Visitor
DAX Formula Help
Link to files in Onedrive Haven't been here in a long time as I thought my DAX skills were supberb. However this is stomping me to the ground. As when I apply a filter on major event ...
- 5 months ago
Hi anthonjhnon1 , You can update the measuer to use remove filters from the dim table
CIs Test 2 = VAR CIs = CALCULATE(SUM(Fact[TotalCustomersAffected]),REMOVEFILTERS('Major Event'[Major Event])) VAR NonME_CIs = CALCULATE(SUM(Fact[nonME_CI]),REMOVEFILTERS('Major Event'[Major Event])) VAR MajorEvent = SELECTEDVALUE('Major Event'[Major Event]) VAR MENo = NonME_CIs VAR MEYes = CIs - NonME_CIs RETURN SWITCH( MajorEvent , "y", MEYes , "n", NonME_CIs , CIs )
SampleData.pbix
Thanks
johnt75
5 months agoSuper User
The issue is that variables in DAX aren't really variable, they're constants. They are only ever evaluated once, so trying to evaluate them again with a modified filter context will not work, they will still have their original value. If you need to change the filter context then you need to include the full definition of the variable again inside the calculate.