Forum Discussion

PowerBiNJ's avatar
PowerBiNJ
Regular Visitor
2 years ago
Solved

Get Survey Summary By Org

I need to get a summary of Survey Response by ORG. For example,

I need to get % summary of Survey Responses for ORG 1 --> Grouped By Category (Cat1, Cat 2, Cat3)  -->drill down to individual Q's

1 & 0 are true or false responses to survey questions. 

Does anyone know how this can be acheieved?

 

Org NameDepartment NameCat 1 Level 1 Q1Cat 1 Level 1 Q2Cat 1 Level 2 Q1Cat 1 Level 2 Q2Cat 1 Level 2 Q3Cat 2 Level 1 Q1Cat 2 Level 2 Q1Cat 2 Level 2 Q2Cat 2 Level 2 Q3Cat 2 Level 3 Q1Cat 2 Level 3 Q2Cat 3 Level 3 Q3
Org 1Department 1100000001000
Org 1Department 2001001110001
Org 1Department 3011110010100
Org 2Department 4111101100101
Org 2Department 5001111110101
Org 3Department 6110100000000
Org 3Department 7011111100001
Org 3Department 8100010011000
Org 3Department 9101001101101
Org 4Department 10010001011110
Org 4Department 11111011110011
Org 4Department 12101011110001
Org 5Department 13010100000000
Org 5Department 14010100000000
Org 5Department 15110001111000
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi PowerBiNJ ,

    Please update the applied codes in your Advanced Editor:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("rdK7DoMwDAXQX6kyM0AePPbufADK0AExgRDi/4VAqsDmXpqhg4co8okdu+tMuwyvwmTm3c+fZR37aT2Oe+QPIe9jBiFLEopLSJRADiRqUD7yhayEPEE4SKBA2kGwhJyESpLAg0BVQjX4sxVUw8nc2/1ZUUPaYh9/VuTVQuKtuyunxqSn4aMl4DVZOOWU5Q5KckBJWwEt+b9JgXbBOoxxAw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Org Name" = _t, #"Department Name" = _t, #"Cat 1 Level 1 Q1" = _t, #"Cat 1 Level 1 Q2" = _t, #"Cat 1 Level 2 Q1" = _t, #"Cat 1 Level 2 Q2" = _t, #"Cat 1 Level 2 Q3" = _t, #"Cat 2 Level 1 Q1" = _t, #"Cat 2 Level 2 Q1" = _t, #"Cat 2 Level 2 Q2" = _t, #"Cat 2 Level 2 Q3" = _t, #"Cat 2 Level 3 Q1" = _t, #"Cat 2 Level 3 Q2" = _t, #"Cat 3 Level 3 Q3" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Org Name", type text}, {"Department Name", type text}, {"Cat 1 Level 1 Q1", Int64.Type}, {"Cat 1 Level 1 Q2", Int64.Type}, {"Cat 1 Level 2 Q1", Int64.Type}, {"Cat 1 Level 2 Q2", Int64.Type}, {"Cat 1 Level 2 Q3", Int64.Type}, {"Cat 2 Level 1 Q1", Int64.Type}, {"Cat 2 Level 2 Q1", Int64.Type}, {"Cat 2 Level 2 Q2", Int64.Type}, {"Cat 2 Level 2 Q3", Int64.Type}, {"Cat 2 Level 3 Q1", Int64.Type}, {"Cat 2 Level 3 Q2", Int64.Type}, {"Cat 3 Level 3 Q3", Int64.Type}}),
        #"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"Cat 1 Level 1 Q1", "Cat 1 Level 1 Q2", "Cat 1 Level 2 Q1", "Cat 1 Level 2 Q2", "Cat 1 Level 2 Q3", "Cat 2 Level 1 Q1", "Cat 2 Level 2 Q1", "Cat 2 Level 2 Q2", "Cat 2 Level 2 Q3", "Cat 2 Level 3 Q1", "Cat 2 Level 3 Q2", "Cat 3 Level 3 Q3"}, "Attribute", "Value"),
        #"Replaced Value" = Table.ReplaceValue(#"Unpivoted Only Selected Columns","Cat ","Cat", Replacer.ReplaceText,{"Attribute"}),
        #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","Level ","Level",Replacer.ReplaceText,{"Attribute"}),
        #"Split Column by Delimiter" = Table.SplitColumn(#"Replaced Value1", "Attribute", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Category", "Level", "Question"}),
        #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Category", type text}, {"Level", type text}, {"Question", type text}}),
        #"Pivoted Column" = Table.Pivot(#"Changed Type1", List.Distinct(#"Changed Type1"[Question]), "Question", "Value", List.Sum)
    in
        #"Pivoted Column"

    Best Regards

4 Replies

    • PowerBiNJ's avatar
      PowerBiNJ
      Regular Visitor

      Hi, thank you for working on this...Is it possible to not merge all Q1,Q2,Q3 together? Every Question is different in in Category and Level.

      Can i just remove the last part "Question" of the Transform Colummn Type-->Split By Column?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi PowerBiNJ ,

        Please update the applied codes in your Advanced Editor:

        let
            Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("rdK7DoMwDAXQX6kyM0AePPbufADK0AExgRDi/4VAqsDmXpqhg4co8okdu+tMuwyvwmTm3c+fZR37aT2Oe+QPIe9jBiFLEopLSJRADiRqUD7yhayEPEE4SKBA2kGwhJyESpLAg0BVQjX4sxVUw8nc2/1ZUUPaYh9/VuTVQuKtuyunxqSn4aMl4DVZOOWU5Q5KckBJWwEt+b9JgXbBOoxxAw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Org Name" = _t, #"Department Name" = _t, #"Cat 1 Level 1 Q1" = _t, #"Cat 1 Level 1 Q2" = _t, #"Cat 1 Level 2 Q1" = _t, #"Cat 1 Level 2 Q2" = _t, #"Cat 1 Level 2 Q3" = _t, #"Cat 2 Level 1 Q1" = _t, #"Cat 2 Level 2 Q1" = _t, #"Cat 2 Level 2 Q2" = _t, #"Cat 2 Level 2 Q3" = _t, #"Cat 2 Level 3 Q1" = _t, #"Cat 2 Level 3 Q2" = _t, #"Cat 3 Level 3 Q3" = _t]),
            #"Changed Type" = Table.TransformColumnTypes(Source,{{"Org Name", type text}, {"Department Name", type text}, {"Cat 1 Level 1 Q1", Int64.Type}, {"Cat 1 Level 1 Q2", Int64.Type}, {"Cat 1 Level 2 Q1", Int64.Type}, {"Cat 1 Level 2 Q2", Int64.Type}, {"Cat 1 Level 2 Q3", Int64.Type}, {"Cat 2 Level 1 Q1", Int64.Type}, {"Cat 2 Level 2 Q1", Int64.Type}, {"Cat 2 Level 2 Q2", Int64.Type}, {"Cat 2 Level 2 Q3", Int64.Type}, {"Cat 2 Level 3 Q1", Int64.Type}, {"Cat 2 Level 3 Q2", Int64.Type}, {"Cat 3 Level 3 Q3", Int64.Type}}),
            #"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"Cat 1 Level 1 Q1", "Cat 1 Level 1 Q2", "Cat 1 Level 2 Q1", "Cat 1 Level 2 Q2", "Cat 1 Level 2 Q3", "Cat 2 Level 1 Q1", "Cat 2 Level 2 Q1", "Cat 2 Level 2 Q2", "Cat 2 Level 2 Q3", "Cat 2 Level 3 Q1", "Cat 2 Level 3 Q2", "Cat 3 Level 3 Q3"}, "Attribute", "Value"),
            #"Replaced Value" = Table.ReplaceValue(#"Unpivoted Only Selected Columns","Cat ","Cat", Replacer.ReplaceText,{"Attribute"}),
            #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","Level ","Level",Replacer.ReplaceText,{"Attribute"}),
            #"Split Column by Delimiter" = Table.SplitColumn(#"Replaced Value1", "Attribute", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Category", "Level", "Question"}),
            #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Category", type text}, {"Level", type text}, {"Question", type text}}),
            #"Pivoted Column" = Table.Pivot(#"Changed Type1", List.Distinct(#"Changed Type1"[Question]), "Question", "Value", List.Sum)
        in
            #"Pivoted Column"

        Best Regards