Forum Discussion
zaraanderson
4 years agoFrequent Visitor
Multiple responses from forms combining
Hi everyone, I've tried my best to research this, but I'm a Power BI newbie and a bit is going over my head. I am collecting data via a "Forms for Excel" survey. I have a multiple response it...
- 4 years ago
Hi zaraanderson ,
In this case you need to take a different approach, keeping the responses has you have you can create disconnected tables with the answrs from the multioption. In this case I have created 2 tables:
Now using this I have created the following two measures:
Pet Count = // Character that split phrase into words VAR SplitByCharacter = ";" // Temporary table that splits selected phrase into words VAR Words_table = ADDCOLUMNS ( GENERATE ( SELECTCOLUMNS ( SUMMARIZE ( ALLSELECTED ( 'Sheet1 (2)' ), 'Sheet1 (2)'[Respondent ID], 'Sheet1 (2)'[Pet type (select all that apply)] ), "Find_Text", 'Sheet1 (2)'[Pet type (select all that apply)] ), VAR TokenCount = PATHLENGTH ( SUBSTITUTE ( [Find_Text], SplitByCharacter, "|" ) ) RETURN GENERATESERIES ( 1, TokenCount ) ), "Word", PATHITEM ( SUBSTITUTE ( [Find_Text], SplitByCharacter, "|" ), [Value] ) ) RETURN COUNTROWS ( FILTER ( Words_table, [Word] IN VALUES ( Pets[Pet type] ) ) ) Food Count = // Character that split phrase into words VAR SplitByCharacter = ";" // Temporary table that splits selected phrase into words VAR Words_table = ADDCOLUMNS ( GENERATE ( SELECTCOLUMNS ( SUMMARIZE ( ALLSELECTED ( 'Sheet1 (2)' ), 'Sheet1 (2)'[Respondent ID], 'Sheet1 (2)'[Favourite foods (select all that apply)] ), "Find_Text", 'Sheet1 (2)'[Favourite foods (select all that apply)] ), VAR TokenCount = PATHLENGTH ( SUBSTITUTE ( [Find_Text], SplitByCharacter, "|" ) ) RETURN GENERATESERIES ( 1, TokenCount ) ), "Word", PATHITEM ( SUBSTITUTE ( [Find_Text], SplitByCharacter, "|" ), [Value] ) ) RETURN COUNTROWS ( FILTER ( Words_table, [Word] IN VALUES ( Foods[Favourite foods] ) ) )Has you can see now you can use these two measures on your calculation:
PBIX attach.
MFelix
4 years agoSuper User
Hi zaraanderson ,
This depends on how you want to present the result but you need to use the split by delimiter option on the query editor only question is if you want a column for each of the values or a row:
https://docs.microsoft.com/en-us/power-query/split-columns-delimiter
Believe that you should go for the split by delimiter in rows