Forum Discussion
venkata
8 years agoRegular Visitor
Need some help with DAX
I am getting below error. Error Message: MdxScript(Model) (11, 118) Calculation error in measure 'StationList'[Measure]: Function 'SWITCH' does not support comparing values of type Text with val...
v-yulgu-msft
Microsoft Employee
8 years agoHi venkata,
It looks like that the SWITCH function in above measure formula doesn't meet the correct syntax.
SWITCH(<expression>, <value>, <result>[, <value>, <result>]…[, <else>])
The <expression> should return a single scalar value, where the expression is to be evaluated multiple times (for each row/context). However, in your scenario, VALUES ( StationList[STATION] ) returns a one-column table that contains the distinct values.
Also, your purpose is that if result of <expression> equals "OTHER", then return SelectedGross, but how about UnSelectedGross and AllGross? What are their corresponding values?
Regards,
Yuliana Gu