Forum Discussion
AlexMic
4 years agoNew Member
Multiple Response Question: Count responses stored in a single column, separated by a space
Hello community.. please your help.. From a multiple question in a quiz, a single column was generated that has all responses separated by a space. I want to build a bar graph that shows the number ...
- 4 years ago
Hi AlexMic ,
If you do not have user name, add an index column to the original file. This can be used as a count of the total number of people.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlSK1YGTOkkwWicZyoLQSUgkqkwyso5YAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Lugar = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Lugar", type text}}), #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type), #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Added Index", {{"Lugar", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Lugar"), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Lugar", type text}}) in #"Changed Type1"Then create a measure like below:
Measure = var total_ =CALCULATE(DISTINCTCOUNT('Table (2)'[Index]),ALL('Table (2)')) var current_row = COUNT('Table (2)'[Index]) return DIVIDE(current_row,total_)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AlexMic
4 years agoNew Member
thanks... it's the first step... but how do I calculate the % with respect to the number of people surveyed (number of rows in the original file).. no versus the number of responses? Thank you.
- Ashish_Mathur4 years agoSuper User
Hi,
You can use the DISTINCTCOUNT() function.