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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
NurAmirah_MY
Regular Visitor

Split data by comma

Hi,

I'm building a template dashboard for survey responses. There are multiple answer question where respondent can select more than answer. Hence, I want to show all the answers in chart. Please note that the responses data comes with , to seperate the answers. Eg: A, B, C, D

 

I have steps build up in power query. The steps are split the column by comma > unpivot selected column > the column can be used to chart the responses. Right now, the template has 4 columns from splitting up the response data (A | B | C | D). What if the survey has more than 4 multiple answers. When I refresh the power query that has data of 5 multiple answers, it didn't split up correctly instead it ignore. Eg: A, B, C, D, E and when split up the column it only shows until D. 

how to solve this? Thanks.

3 REPLIES 3
NurAmirah_MY
Regular Visitor

Hi @Fowmy 

 

Thanks for this solution. Will try in a bit.  Can I know when the power query run the split by column, if I want those columns after splitting to be unpivot, how can I do that?

@NurAmirah_MY 

Wihout having a sample data set, It's hard to assume and share a solution. 

Sharing a dummy Power BI file representing your scenario would be beneficial. You can save the Power BI file on Google Drive or any other cloud storage platform and provide the link here. Kindly ensure that permission is granted to open the file.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Fowmy
Super User
Super User

@NurAmirah_MY 

You can split into ROWS under advanced:

Fowmy_0-1703847833060.png

 

Paste this code in a Blank Query and check the steps, add, more responses e,f,g


let

    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUrUSdJJ1knRSVWK1YlWMgKLAPlKsbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Response = _t]),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Response", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Response"),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"ID", Int64.Type}, {"Response", type text}})
in
    #"Changed Type"



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors