Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Mutiple answer question in power BI

 

Dears,

please i need your help where i am not sure how to visualize multiple answers question, where each respondent has more than answer that were entered in a different column, for ex answer 1 in col 1 and answer 2 in col 2,etc.

but they are different answers and i need to combine them to visualize this question, please advise what the best way/chart is to do it.

 

Many Thanks

6 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable
      IDF2a.Code1F2a.Code2F2a.Codes3
      1001 1
      1013 3
      1022 2
      1033 3
      1043 3
      1051 1
      1063 3
      1072 2
      1081 1
      1091  
      1101  
      1111  
      1122  
      1131  
      1141  
      1152  
      1163  
      1173  
      1182  
      1194  
      1201  
      1214  
      1221  
      1232  
      1241  
      1251  
      1264  
      12721 
  • Anonymous's avatar
    Anonymous
    Not applicable

    i have sent a sample data where i want to display and visualize F2a (after merging the codes) and keep the sample size as it is 28 so the total should me more than 100% since it 's a multiple answer question duer to each respondent might give more than one answer

     

    Many thanks

    Noha

    • lbendlin's avatar
      lbendlin
      Icon for Super User rankSuper User

      here's how you transpose/unpivot your data to make it usable. This will work for any number of columns.

       

      let
          Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdFBCoAgEIXhq4jrFs6MWp1FvP810lQw+heSfrxheFSKlxD84aUd937r0a2/bZpN03bXaTrNIBfBEuzIkDthxwWz92ZumAQwAdt7LDPIRbAEs3uPZSfYBbO9R/yaQg8VyCnk7L9DoYcmsAw71v8Y2Vof", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, F2a.Code1 = _t, F2a.Code2 = _t, F2a.Codes3 = _t]),
          #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"ID"}, "Attribute", "Value"),
          #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] <> " "))
      in
          #"Filtered Rows"

      How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

      • Anonymous's avatar
        Anonymous
        Not applicable

        Thank you Ibendin so much for your help and support,it is working fine for this specifc question but for others questions with the same concept it didn't work 

         

        for example i have another question with the same structure : ID,column name (Q8_code_1,Q8_code_2,Q8_code_3,Q8_code_4) and the codes that was inserted not codes but text for example (lack of trainings,no clear career path,low salries,...) how can i edit the code to work on the similar concept taking into the consideration the sample size is different from question to another

         

        one question is 780 another is 130 etc

         

        many thanks again