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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
jainesh12
Frequent Visitor

undefined

I've got the below column from MongoDB i.e. of embedded approach, and the column is of "Object" type.
How can I simplify the below?

orders1.PNGorders2.PNG

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @jainesh12 

 

From the screenshot, the values are not in a standard format that many symbols are not in pairs e.g. "", [], {}. I'm not sure what is your expected result. But since the value format is similar to JSON format, I think you may want to transform each row's Orders data into a table which has columns OrderItem_ID, Product_ID, Quantity, Order_Amount and Order_Date.

 

If my guess is correct, you can try my solution. 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfIvSkktijeMUbKKro6B8DxLUnPjPV2AQoY6MUoBRfkppcklCIHA0sS8ksySSiDXWAeqJd4xN780rwQkZGAAF3RJLEkFCsUoGRkYGesamAFRjFJtLFzeCLutRui2GqHaaoppqyluWy10DUxBttbGxirF6kQrGcE8jbAwRilGCdNMqCiKS6BiSI5B0Qu3GmyT8cAEL9ijsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Index = _t, Orders = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}, {"Orders", type text}}),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"Orders", Splitter.SplitTextByDelimiter("}],", QuoteStyle.None), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Orders"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Orders", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type1","""","",Replacer.ReplaceText,{"Orders"}),
    #"Extracted Text Between Delimiters" = Table.TransformColumns(#"Replaced Value", {{"Orders", each if Text.Contains(_, "[{") then Text.BetweenDelimiters(_, "[{", "}]") else _, type text}}),
    #"Added Custom" = Table.AddColumn(#"Extracted Text Between Delimiters", "Custom", each Table.PromoteHeaders(Table.Transpose(Table.SplitColumn(Table.FromList(List.Sort(Text.Split([Orders], ","))), "Column1", Splitter.SplitTextByDelimiter(":"),2)), [PromoteAllScalars=true])),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"OrderItem_ID", "Order_Amount", "Order_Date", "Product_ID", "Quantity"}, {"OrderItem_ID", "Order_Amount", "Order_Date", "Product_ID", "Quantity"})
in
    #"Expanded Custom"

vjingzhang_0-1688463969997.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Thank you @v-jingzhang , this might help.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors