Forum Discussion
eyelesszues123
2 years agoNew Member
Sumifs formula to Dax
I'm trying to translate my IF/ Sum IF formula to DAX. I basically want to show the quota attainment for each employee but based on their position. So if they are a manager then the total of the teams...
- 2 years ago
Hi eyelesszues123, check this. I've also attached pbix file.
Result
Total Attainment = VAR _rep = SELECTEDVALUE('Table'[Rep Name]) VAR _role = SELECTEDVALUE('Table'[Role]) VAR _result = SWITCH( _role, "Rep", [Rep Attainment Total], "Manager", CALCULATE([Rep Attainment Total], KEEPFILTERS('Table'[Manager] = _rep), REMOVEFILTERS()), "Director", CALCULATE([Rep Attainment Total], KEEPFILTERS('Table'[Director] = _rep), REMOVEFILTERS()) ) RETURN _result
dufoq3
2 years agoCommunity Champion
Hi eyelesszues123, check this. I've also attached pbix file.
Result
Total Attainment =
VAR _rep = SELECTEDVALUE('Table'[Rep Name])
VAR _role = SELECTEDVALUE('Table'[Role])
VAR _result =
SWITCH(
_role,
"Rep", [Rep Attainment Total],
"Manager", CALCULATE([Rep Attainment Total], KEEPFILTERS('Table'[Manager] = _rep), REMOVEFILTERS()),
"Director", CALCULATE([Rep Attainment Total], KEEPFILTERS('Table'[Director] = _rep), REMOVEFILTERS())
)
RETURN _result
eyelesszues123
2 years agoNew Member
Works Perfectly, thank you dufoq3
- dufoq32 years agoCommunity Champion
You're welcome