Forum Discussion
[SSAS] Measure := IF [column1] = "ABCD" then DIVIDE()... else... DIVIDE()
Depends on your need.
If you have column1 on axis or slicers you can do this:
measure = if(selectedvalue(Table[column1])="Y";......
If you want to have the sum across all values in column, but with different calculations for them you can try this
measure = sumx(table,if(selectedvalue(Table[column1])=1;....)
sturlaws, thanks. Column1 is more of used as flag column and is not used later in the report/filters/is vislble to users at all.
So not sure whether selectedvalue() will be proper here.
- sturlaws7 years ago
Resident Rockstar
The selectedvalue() has perhaps a bit misleading name, but these two expressions are equivalent
SELECTEDVALUE( <columnName>, <alternateResult>)
IF(HASONEVALUE(<columnName>), VALUES(<columnName>), <alternateResult>)
If the filter context has narrowed the values in the column down one unique value, this value is returned, otherwise a blank or alternative value is returned: https://dax.guide/selectedvalue/
If column 1 is a flag value, and not something you will add in a report the SUMX-version is probably what will give you what you need.