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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
chris886
Frequent Visitor

Splitting Multiple Columns by Delimiter and Counting Multiple Values

I've been searching but my issues seems to be different than a lot of the 'splitting multiple columns' solutions I've seen. My values are just multiple options within a form and do not have any relationship to the other columns, but I need to be able to measure them individually.

 

Here's my sample data:

 

Index

Is PublicColorShapeSize
1YesRed, Yellow, GreenSquare, CircleSmall, "Large, Tall"
2YesYellow, BlueCircleSmall
3NoRed, Green, BlackSquare, TriangleMedium, "Large, Tall"
4YesWhiteTriangle, RectangleSmall, Medium
5NoGreen, BlackRectangleMedium

 

The index column serves as each form submission, and is intended to be my 'event count'. Beyond that, I just want to be able to measure/visualize each column of data separately. A table showing counts for each color, another showing counts for each shape, etc.

 

I've tried splitting column into rows and columns, but neither seems to work. Rows will break out the data into false events and splitting into columns doesn't allow me to count all the values in one group. I'm also can't figure out how to delimit the 'Large, Tall' item since it includes a comma within the text value.

 

Appreciate any help!

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@chris886 Might be better ways but see if this works. PBIX is attached below signature.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY69DsIwDIRfJfLshb8XgIEFGEolVKUdotYqEW4rQiNenyTgqiAWS7bvuzutYQEIBT3CzKhBVRDz8ES1d0R9OJ7v3jhCtbOuZoqHzjCjKuFgXBseeVhLgAo1LCcrcdmyj8w3nLSrsJ0GSU1pUW7q2yw0d9b0bSKP1Fjf/c9dT7mXqx2jWkBUGdWjeHyqv60SuZEWPwXmlMirFw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Index = _t, #"Is Public" = _t, Color = _t, Shape = _t, Size = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}, {"Is Public", type text}, {"Color", type text}, {"Shape", type text}, {"Size", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Size", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Size.1", "Size.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Size.1", type text}, {"Size.2", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type1", "Shape", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Shape.1", "Shape.2"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Shape.1", type text}, {"Shape.2", type text}}),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Changed Type2", "Color", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Color.1", "Color.2", "Color.3"}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Split Column by Delimiter2",{{"Color.1", type text}, {"Color.2", type text}, {"Color.3", type text}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type3", {"Index", "Is Public"}, "Attribute", "Value"),
    #"Trimmed Text" = Table.TransformColumns(#"Unpivoted Columns",{{"Value", Text.Trim, type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Trimmed Text",".1","",Replacer.ReplaceText,{"Attribute"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",".2","",Replacer.ReplaceText,{"Attribute"}),
    #"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1",".3","",Replacer.ReplaceText,{"Attribute"})
in
    #"Replaced Value2"

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

@chris886 Might be better ways but see if this works. PBIX is attached below signature.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bY69DsIwDIRfJfLshb8XgIEFGEolVKUdotYqEW4rQiNenyTgqiAWS7bvuzutYQEIBT3CzKhBVRDz8ES1d0R9OJ7v3jhCtbOuZoqHzjCjKuFgXBseeVhLgAo1LCcrcdmyj8w3nLSrsJ0GSU1pUW7q2yw0d9b0bSKP1Fjf/c9dT7mXqx2jWkBUGdWjeHyqv60SuZEWPwXmlMirFw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Index = _t, #"Is Public" = _t, Color = _t, Shape = _t, Size = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}, {"Is Public", type text}, {"Color", type text}, {"Shape", type text}, {"Size", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Size", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Size.1", "Size.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Size.1", type text}, {"Size.2", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type1", "Shape", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Shape.1", "Shape.2"}),
    #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Shape.1", type text}, {"Shape.2", type text}}),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Changed Type2", "Color", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Color.1", "Color.2", "Color.3"}),
    #"Changed Type3" = Table.TransformColumnTypes(#"Split Column by Delimiter2",{{"Color.1", type text}, {"Color.2", type text}, {"Color.3", type text}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type3", {"Index", "Is Public"}, "Attribute", "Value"),
    #"Trimmed Text" = Table.TransformColumns(#"Unpivoted Columns",{{"Value", Text.Trim, type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Trimmed Text",".1","",Replacer.ReplaceText,{"Attribute"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",".2","",Replacer.ReplaceText,{"Attribute"}),
    #"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1",".3","",Replacer.ReplaceText,{"Attribute"})
in
    #"Replaced Value2"

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.