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.
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.
- Anonymous3 years agoNot applicable
Here is a more universal solution.
Selected Parameter = VAR SearchString = SELECTEDVALUE('Field Parameters'[Parameter]) VAR LeftBound = SEARCH("[",SearchString) VAR RightBound = SEARCH("]",SearchString) RETURN MID(SearchString,LeftBound + 1,RightBound-(LeftBound+1))- Gibby_ngam1 year agoFrequent Visitor
This works if you only want the text, not the measure 🙂. This is perfect for me since I only want the display text, not the measures
- avisingh9 months agoAdvocate IV
Actually this does not work at all.
SELECTEDVALUE('Field Parameters'[Parameter])
Always returns the error as below:
"Column [Parameter] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression."