Forum Discussion
Conditional Column - Survey Ratings
try this
=Table.AddColumn(#"Removed Blank Rows", "Response ID",each {null,"Agree/Strongly Agree","Others"}{List.Skip(List.Transform({[XXX is Faster and Easier],[#"Overall Positive Experience "],[Recommend my Colleagues]},each List.PositionOf({{"Strongly Agree","Agree"},{"Slightly Agree","Slightly Disagree","Disagree","Strongly Disagree"}},_,0,(x,y)=>List.Contains(x,y))),each _=-1){0}?+1 ??0})
- shermayne1233 years agoHelper I
Hi wdx223_Daniel,
Thanks for your code. I tried it but it did not give correct classification for all of the responses to the first question because there were 3 blank answers as the question did not apply to this group of respondents. The code correctly classified two of the responses as Others but one of them as Agree/Strongly Agree. How should I go about amending the code to fit this type of scenario? Below screenshot is after I unpivot the columns. You can see the errors in classification for second and third question here as well.
- wdx223_Daniel3 years agoCommunity Champion
i'm confused of your calculation logic.
as your formula, these three columns have different priority. so when [XXX is Faster and Easier] is "Disagree", it will be classified to "Others".
- shermayne1233 years agoHelper I
Hi wdx223_Daniel,
The 3 questions have equal priority. As per my reply to HotChilli just now, the way to get the result I want is not to reclassify the responses(add conditional columns) before I unpivot them. I should have unpivot the 3 question columns then add the conditional column to reclassify the responses accordingly. Hope that clarifies and thanks for looking into my problem.