Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ToCa
New Member

Transform a column that shows multiple selections from a survey

Hi,

 

What's the best way to transform the column below in power bi so that I can display a chart like the picture at the bottom?

For context this is a multiple selection question in microsoft forms where each row is a new response. 

 

Ferry;Airfare;Public Transportation costs (e.g. bus, taxi);Personal vehicle costs (e.g. gas);Parking;Unpaid time off from work;Accomodation and/or meals ;
Airfare;Personal vehicle costs (e.g. gas);Parking;Accomodation and/or meals ;
Ferry;Airfare;Public Transportation costs (e.g. bus, taxi);Parking;
Not applicable ;
Personal vehicle costs (e.g. gas);
Unpaid time off from work;Accomodation and/or meals ;
Not applicable ;
Personal vehicle costs (e.g. gas);Parking;Accomodation and/or meals ;

ToCa_0-1755629393061.png

 

1 ACCEPTED SOLUTION
Cookistador
Super User
Super User

Hello @ToCa 

 

The easiest way to achieve that is to create a reference(or a copy) of your table in Power Query,

Then you only keep the unique ID and the response (in my case the color)

Cookistador_1-1755635103380.png

 

So you will have a table with two columns, after that you use Split the column by delimiter Comma (or the delimiter you need) and select for each occurence

Cookistador_2-1755635140980.png

 

You select all the column you get as result and select unpivot the columns

It will returns the following table:

Cookistador_0-1755635050179.png

 

Then you delete the table Attribute and now you have your dimension table and you can link it to the main table

 

If you need more support, do not hesistate for help 🙂

 

This is the code generated :

let
    Source = Table,
    #"Autres colonnes supprimées" = Table.SelectColumns(Source,{"Id", "Color"}),
    #"Fractionner la colonne par délimiteur" = Table.SplitColumn(#"Autres colonnes supprimées", "Color", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Color.1", "Color.2", "Color.3"}),
    #"Type modifié" = Table.TransformColumnTypes(#"Fractionner la colonne par délimiteur",{{"Id", Int64.Type}, {"Color.1", type text}, {"Color.2", type text}, {"Color.3", type text}}),
    #"Tableau croisé dynamique des colonnes supprimé" = Table.UnpivotOtherColumns(#"Type modifié", {"Id"}, "Attribut", "Valeur"),
    #"Colonnes supprimées1" = Table.RemoveColumns(#"Tableau croisé dynamique des colonnes supprimé",{"Attribut"})
in
    #"Colonnes supprimées1"

View solution in original post

2 REPLIES 2
Cookistador
Super User
Super User

Hello @ToCa 

 

The easiest way to achieve that is to create a reference(or a copy) of your table in Power Query,

Then you only keep the unique ID and the response (in my case the color)

Cookistador_1-1755635103380.png

 

So you will have a table with two columns, after that you use Split the column by delimiter Comma (or the delimiter you need) and select for each occurence

Cookistador_2-1755635140980.png

 

You select all the column you get as result and select unpivot the columns

It will returns the following table:

Cookistador_0-1755635050179.png

 

Then you delete the table Attribute and now you have your dimension table and you can link it to the main table

 

If you need more support, do not hesistate for help 🙂

 

This is the code generated :

let
    Source = Table,
    #"Autres colonnes supprimées" = Table.SelectColumns(Source,{"Id", "Color"}),
    #"Fractionner la colonne par délimiteur" = Table.SplitColumn(#"Autres colonnes supprimées", "Color", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Color.1", "Color.2", "Color.3"}),
    #"Type modifié" = Table.TransformColumnTypes(#"Fractionner la colonne par délimiteur",{{"Id", Int64.Type}, {"Color.1", type text}, {"Color.2", type text}, {"Color.3", type text}}),
    #"Tableau croisé dynamique des colonnes supprimé" = Table.UnpivotOtherColumns(#"Type modifié", {"Id"}, "Attribut", "Valeur"),
    #"Colonnes supprimées1" = Table.RemoveColumns(#"Tableau croisé dynamique des colonnes supprimé",{"Attribut"})
in
    #"Colonnes supprimées1"
GeraldGEmerick
New Member

@ToCa This can be done fairly easily in Power Query. You can first Split by Delimeter (semi-colon) and then Unpivot all of the resulting columns. Then remove blanks if necessary. You can then place the Values column into the visual for you Y-Axis and then Count of Values column for the X-Axis:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pZC9DoMwDIRfxWJqJUQfIBNLx4qhnRCDCQmNSOLICf15+yKoKnWioqt1vu/u6jo7KuanKA1rZCWqsbVGwpnRx0CcMBnyICmmCDtV9AW0Y8wh4cPsRaU4kkcLN3U10qovXY9xUiAPxvfi4gOaDpJxCkhr0EwO7sSDKKUkR93CQd8diMEptBFE1uR19gn2M2vN8Z/Cb8Tsc6IEGML0je2UZzmux5xl2/fYSP1pnOYF", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Answers = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Answers", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Answers", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Answers.1", "Answers.2", "Answers.3", "Answers.4", "Answers.5", "Answers.6", "Answers.7", "Answers.8"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Answers.1", type text}, {"Answers.2", type text}, {"Answers.3", type text}, {"Answers.4", type text}, {"Answers.5", type text}, {"Answers.6", type text}, {"Answers.7", type text}, {"Answers.8", type text}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type1", {}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Value] <> ""))
in
    #"Filtered Rows"

GeraldGEmerick_0-1755631473310.pngGeraldGEmerick_1-1755631524128.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors