Forum Discussion
Model Relationship
- 4 years ago
SWITCH is a function used in measures /calculated columns wich is essentially nested IFs executed in order. So the measure in this case is checking the filter context (established by SELECTEDVALUE) and returning the corresponding measure. So the first statement checks whether the conext is "A1" and if true returns the measure [M1] and so on...Make sense?
Try
TheMeasures =
SWITCH(SELECTEDVALUE (Table1[Key Service]),
"A1", [M1],
"A1.1", [M6],
"A2", [M2])
- FaisalImam4 years agoHelper I
Can you explain brief please ? I am a begginer.
Do you mean to create a new column using the above switch statement ? if so in which table ? The one having static data or the one where we have calculated the measures.
- PaulDBrown4 years agoCommunity Champion
You need to create a new measure with the code. Then create a new table visual, add the fields from Table 1 and add the measure
- FaisalImam4 years agoHelper I
Hi PaulDBrown,
Thanks , this actually somewhat worked. Can you please explain what the qwuery is actually doing as that would be helpful for me to learn.
- PaulDBrown4 years agoCommunity Champion
SWITCH is a function used in measures /calculated columns wich is essentially nested IFs executed in order. So the measure in this case is checking the filter context (established by SELECTEDVALUE) and returning the corresponding measure. So the first statement checks whether the conext is "A1" and if true returns the measure [M1] and so on...Make sense?