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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Explose Lines in Power Query

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 :

CaptureA.PNG

 

Needed result :

CaptureB.PNG

 

So there is any option to do this please in Power Query?

 

Thank you in advance for your Help

1 ACCEPTED SOLUTION
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

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"

 

View solution in original post

3 REPLIES 3
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

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"

 

Syndicate_Admin
Administrator
Administrator

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}))
)

Anonymous
Not applicable

Hello ,

How I need to do? I need to create a Function ?

I need to replae the code?

sorry it's not clear

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors