Forum Discussion
Parameter: Fields selected value
- 4 years ago
Hi rdg515 ,
Please try the measure.
Selected Survey Avg Rating = SWITCH ( SELECTEDVALUE ( prmSurveyResponses[prmSurveyResponses Fields] ), NAMEOF ( 'Service Survey'[NPSResponseCode] ), [NPS Avg Rating], NAMEOF ( 'Service Survey'[CustomerEffortResponseCodeText] ), [Customer Effort Avg Rating], NAMEOF ( 'Service Survey'[ProductCompetitionResponseCodeText] ), [Product Competition Avg Rating] )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - 4 years ago
Thanks, but I was looking for a way to avoid referencing the parameter table in the Avg Rating measure because I had many measures like this that I had to update when I changed the name of the parameter table. Having said that, I realized I missed an obvious solution which was to just do this in two steps and if I had to change the paramater table name again I'd just have to do it for one measure.
Step 1:
Selected Parameter = SELECTEDVALUE ( prmSurveyResponses[prmSurveyResponses Fields] )
Step 2:
Selected Survey Avg Rating =
SWITCH (
[Selected Parameter],
NAMEOF ( 'Service Survey'[NPSResponseCode] ), [NPS Avg Rating],
NAMEOF ( 'Service Survey'[CustomerEffortResponseCodeText] ), [Customer Effort Avg Rating],
NAMEOF ( 'Service Survey'[ProductCompetitionResponseCodeText] ), [Product Competition Avg Rating]
)Thanks for the tip to use NAMEOF instead of using double quotes around the column name.
P.S. I keep getting the following error when formatting the dax code as HTML/XML code snippit:
Your post has been changed because invalid HTML was found in the message body. The invalid HTML has been removed. Please review the message and submit the message when you are satisfied.
Thanks, but I was looking for a way to avoid referencing the parameter table in the Avg Rating measure because I had many measures like this that I had to update when I changed the name of the parameter table. Having said that, I realized I missed an obvious solution which was to just do this in two steps and if I had to change the paramater table name again I'd just have to do it for one measure.
Step 1:
Selected Parameter = SELECTEDVALUE ( prmSurveyResponses[prmSurveyResponses Fields] )
Step 2:
Selected Survey Avg Rating =
SWITCH (
[Selected Parameter],
NAMEOF ( 'Service Survey'[NPSResponseCode] ), [NPS Avg Rating],
NAMEOF ( 'Service Survey'[CustomerEffortResponseCodeText] ), [Customer Effort Avg Rating],
NAMEOF ( 'Service Survey'[ProductCompetitionResponseCodeText] ), [Product Competition Avg Rating]
)
Thanks for the tip to use NAMEOF instead of using double quotes around the column name.
P.S. I keep getting the following error when formatting the dax code as HTML/XML code snippit:
Your post has been changed because invalid HTML was found in the message body. The invalid HTML has been removed. Please review the message and submit the message when you are satisfied.
- Mohith_ds1 year agoNew Member
The protip to use NAMEOF was a lifesaver. Thanks.