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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Power Query Editor split object to columns

Hi Community,

 

Have not been able to find a solution myself so I am asking my fellow community members. I have a column with product attributes in an array object. I have attached an example. In the example I have two products that have 12 attributes each. 

 

[{"brand":"brand1","category":"category1","currency":"EUR","ean":"ean1","edition":3,"isbn":"isbn1","name":"name1","price":"9.95","product_id":"id1","product_type":"producttype1","quantity":1,"variant":"regular"},{"brand":"brand2","category":"category2","currency":"EUR","ean":"ean2","edition":1,"isbn":"isbn2","name":"name2","price":"9.95","product_id":"id2","product_type":"producttype2","quantity":1,"variant":"regular"}]

 

I would like to have Power Query Editor solution for splitting this one column into 12 seperate columns, where the first value [before the colon] of the attribute will become the name of column and the second value [after the colon] becomes the actual row value. Please note: The value of the attribute might include comma's, colons and brackets as well. Hence, 

 

"brand":"brand1"

 

is an example of a clean attribute. But this might as well look something like:

 

"brand":["This is an example of a not, so clean combination of attribute and value",""something else"]

 

Hope someone is able to help me out!

6 REPLIES 6
Anonymous
Not applicable

@Anonymous 

Cannot access 😥.

 

V-pazhen-msft_0-1623200485294.png

 

Paul

 

Anonymous
Not applicable

@Anonymous Let's try this again: https://we.tl/t-gY8EmMDBmR.

Anonymous
Not applicable

@Anonymous 

Can you just show a table format of your data, and also show the expected output in a table. 

 

Best Regards
Paul

Anonymous
Not applicable

@Anonymous,

 

Thank you for replying. I have just created a Power BI file with a few rows of our Order data file and the expected end result table. You can download the file here: https://we.tl/t-rMnqZIbIek.

 

It appears that the error is caused by some rows in the products column having more than 500 bytes of data which cuts of part of the string and we don't have the '}]' closing the string identifying these rows as actualy having json formatting.

 

Hope you can help me out!

CNENFRNL
Community Champion
Community Champion

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jY9BCsIwEEXvknUREnFR915AcNUUSZNQBjStYyIU8e4mmbiwRewq89/8wLymYc1Tsg6VM5Lty8QlqyTTytt+wCnzTyirgGidptXhdMzQKpdzfKllDXgYEtzGBPeO9mmgglNXm1EaCI0Imli9qXcFDSZofwa6EAz/wn4a6UMBKVPjFpTz4NOVPMaHQoggd9H24aJQsle11Be/9cUqfTHT53N9sdQXq/XFX32xXr9lbfsG", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Json = _t]),
    Parse = Table.TransformColumns(Source, {"Json", each Table.FromRecords(Json.Document(_))}),
    #"Expanded Json" = Table.ExpandTableColumn(Parse, "Json", {"brand", "category", "currency", "ean", "edition", "isbn", "name", "price", "product_id", "product_type", "quantity", "variant"}, {"brand", "category", "currency", "ean", "edition", "isbn", "name", "price", "product_id", "product_type", "quantity", "variant"})
in
    #"Expanded Json"

Screenshot 2021-05-31 161414.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

@CNENFRNL Thank you for the reply. As stated in my previous message. A standard JSON parse is not going to work out for me as this array does not follow a standard json format. Any other solution?

 

jdejonge_0-1622532294783.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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