Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hello All,
I need your help for power query issue, il need to explose lines in my table regarding the category and Product Columns like shown below :
Original Table :
Needed result :
So there is any option to do this please in Power Query?
Thank you in advance for your Help
Solved! Go to Solution.
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQpJLS4BUo4gbKgUqxOtZAQVLYHKWDuB5awdjcDSxlBpQyNjiKy1M5B2hkiaQCVNQHIuIAwRN4WKm5pZwiWsIyD2maEY6GwNknU2VoqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Client = _t, Category = _t, Product = _t]),
Custom1 = Table.ReplaceValue(Source,each [Category],each Text.Split([Category],";"),Replacer.ReplaceValue,{"Category"}),
Custom2 = Table.ReplaceValue(Custom1,each [Product],each Text.Split([Product],";"),Replacer.ReplaceValue,{"Product"}),
#"Expanded Category" = Table.ExpandListColumn(Custom2, "Category"),
#"Expanded Product" = Table.ExpandListColumn(#"Expanded Category", "Product")
in
#"Expanded Product"
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQpJLS4BUo4gbKgUqxOtZAQVLYHKWDuB5awdjcDSxlBpQyNjiKy1M5B2hkiaQCVNQHIuIAwRN4WKm5pZwiWsIyD2maEY6GwNknU2VoqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Client = _t, Category = _t, Product = _t]),
Custom1 = Table.ReplaceValue(Source,each [Category],each Text.Split([Category],";"),Replacer.ReplaceValue,{"Category"}),
Custom2 = Table.ReplaceValue(Custom1,each [Product],each Text.Split([Product],";"),Replacer.ReplaceValue,{"Product"}),
#"Expanded Category" = Table.ExpandListColumn(Custom2, "Category"),
#"Expanded Product" = Table.ExpandListColumn(#"Expanded Category", "Product")
in
#"Expanded Product"
Hi @Syndicate_Admin ,
I hope my sample code will help:
ClearCollect(
collsampledata,
{
ID: 1,
Client: "Test",
Category: "A"
},
{
ID: 2,
Client: "Test2",
Category: "A;B"
}
);
ForAll(
collsampledata As currentrow,
ForAll( Split(
currentrow.Category,
";"
) As newdata,Collect(colldata,{ID:currentrow.ID, Client:currentrow.Client,Category:newdata.Result}))
)
Hello ,
How I need to do? I need to create a Function ?
I need to replae the code?
sorry it's not clear
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 7 | |
| 5 | |
| 5 |