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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jasonfordx
Helper II
Helper II

How to convert a Column that contains List Value and inside of this list value, contains a Record vl

Dear all, good afternoon, how are you?

 

I am facing a problem that I am not able to solve by myself.

 

I have a big query, reading data from different APIs, which make every alteration consumes 1 minute, but anyway

 

My situation is, I am doing a research and I need to read a data inside of that Column (investment.returns.monthly.2016):

 

1.png

 

But that column contain a LIST value per each row as you can see. Since this column contains 12 records (12 months) and inside of each record, contains 3 values (price at the first day of the month, price at the last day of the month, %variace of the month).

 

I Would like to convert this column into 12 different columns containing just one record, the first day of the month. Could you gentlemen help me to solve this issue?

 

Kind Regards,

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

Please try replacing "value" by "s" like so:

 

LastStep = Table.TransformColumns(#"Expanded investment.returns.monthly" , {{"investment.returns.monthly.2016", each Table.Transpose(Table.FromList(List.Transform(_, each Record.Field(_, "s"))))}})

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

6 REPLIES 6
v-chuncz-msft
Community Support
Community Support

@jasonfordx,

 

You may refer to the post below.

https://community.powerbi.com/t5/Desktop/JSON-gt-Parse-List-of-List-of-Records/m-p/517201#M241801

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

The solution from @v-chuncz-msft is correct, but in order to apply it to your specific case, you'd have to modify it like this:

 

Table.TransformColumns(<PreviousStepName>, {{"investment.returns.monthly.2016", each Table.Transpose(Table.FromList(List.Transform(_, each Record.Field(_, "value"))))}})

Where you have to replace <PreviousStepName> by the name of the previous step in the query editor.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi Mrs. Imkef, how are you?

 

First of all, thanks for your time and support.

 

Probably I did something wrong because didnt work. These are my last steps:

 

    #"Expanded investment.returns" = Table.ExpandRecordColumn(#"Expanded investment.historicals", "investment.returns", {"monthly", "yearly"}, {"investment.returns.monthly", "investment.returns.yearly"}),
    #"Expanded investment.returns.yearly" = Table.ExpandRecordColumn(#"Expanded investment.returns", "investment.returns.yearly", {"2016", "2017", "2018"}, {"investment.returns.yearly.2016", "investment.returns.yearly.2017", "investment.returns.yearly.2018"}),
    #"Extracted Values" = Table.TransformColumns(#"Expanded investment.returns.yearly", {"exchanges", each Text.Combine(List.Transform(_, Text.From), ";"), type text}),
    #"Expanded investment.returns.monthly" = Table.ExpandRecordColumn(#"Extracted Values", "investment.returns.monthly", {"2016", "2017", "2018"}, {"investment.returns.monthly.2016", "investment.returns.monthly.2017", "investment.returns.monthly.2018"})
in
    #"Expanded investment.returns.monthly"Print.png

ImkeF
Community Champion
Community Champion

So you have to add my formula as the last step like so for example:

 

    #"Expanded investment.returns" = Table.ExpandRecordColumn(#"Expanded investment.historicals", "investment.returns", {"monthly", "yearly"}, {"investment.returns.monthly", "investment.returns.yearly"}),
    #"Expanded investment.returns.yearly" = Table.ExpandRecordColumn(#"Expanded investment.returns", "investment.returns.yearly", {"2016", "2017", "2018"}, {"investment.returns.yearly.2016", "investment.returns.yearly.2017", "investment.returns.yearly.2018"}),
    #"Extracted Values" = Table.TransformColumns(#"Expanded investment.returns.yearly", {"exchanges", each Text.Combine(List.Transform(_, Text.From), ";"), type text}),
    #"Expanded investment.returns.monthly" = Table.ExpandRecordColumn(#"Extracted Values", "investment.returns.monthly", {"2016", "2017", "2018"}, {"investment.returns.monthly.2016", "investment.returns.monthly.2017", "investment.returns.monthly.2018"}),
LastStep = Table.TransformColumns(#"Expanded investment.returns.monthly" , {{"investment.returns.monthly.2016", each Table.Transpose(Table.FromList(List.Transform(_, each Record.Field(_, "value"))))}})
in
LastStep

 

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Into that Column: investment.returns.monthly.2016 has 12 RECORD values. For each RECORD, has 3 different values.

 

I am saying that, because after I used your suggestion, this is the error:

 

I would like to expand this column: investment.returns.monthly.2016 into 12 different columns, and them, expand these new columns in three new ones.

 

Print2.png

ImkeF
Community Champion
Community Champion

Please try replacing "value" by "s" like so:

 

LastStep = Table.TransformColumns(#"Expanded investment.returns.monthly" , {{"investment.returns.monthly.2016", each Table.Transpose(Table.FromList(List.Transform(_, each Record.Field(_, "s"))))}})

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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