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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
MatheusGuzman
Regular Visitor

Need help extracting single values from specific Records

Hello!

Need some help trying to extract some data, begginer learning Powerquery at the moment.
I have this table, wich one of the columns has Lists.

MatheusGuzman_0-1732541692411.png

Inside each list i has 4 records.

MatheusGuzman_1-1732541769491.png

I need specifically one of the values inside the record, to be added to the table as a new column

MatheusGuzman_2-1732541802676.png

Any ideas on how exactly should i do this?

 

Thank in advance!

4 ACCEPTED SOLUTIONS
m_dekorte
Resident Rockstar
Resident Rockstar

Hi @MatheusGuzman 
There are a couple of ways to achieve this, depening on your specific needs:
List.First or List.Last will get you the first or last record from the list in the status field
alternatively you can use optional item access to extract an item on its zero-based index position and optional field access, here's what that could look like. 

Pick one of these lines of code and paste them into the formula area of the Custom Column dialog:

List.First([status])[creationDate]?

List.Last([status])[creationDate]?

[status]{1}?[creationDate]?

View solution in original post

jgeddes
Super User
Super User

You can use the Table.TransformColumns function to work within the lists in the status column. 
a sample would look like...

= Table.TransformColumns(duplicateStatusList, {{"creationDate", each List.First(List.Select(_, each Record.HasFields(_, "creationDate")))}})

In this function, for each row in the table (table is named 'duplicateStatusList' here) in the 'creationDate' column select the first value in the list of records that have 'creationDate' as the header.

You can then expand the resulting record in the 'creationDate' column.

Here is a complete example code you can paste into the advanced editor of a blank query.

let
    Source = 
    #table(
        {"ticketID", "status"}, 
        {
            {10, {[id="31"], [creationDate=#date(2024,11,21)], [action=7]}},
            {9,{[id="32"], [creationDate=#date(2024,11,22)], [action=6]}}
        }
    ),
    duplicateStatusList = Table.AddColumn(Source, "creationDate", each [status]),
    selectFirstCreationDate = Table.TransformColumns(duplicateStatusList, {{"creationDate", each List.First(List.Select(_, each Record.HasFields(_, "creationDate")))}}),
    expandRecord = Table.ExpandRecordColumn(selectFirstCreationDate, "creationDate", {"creationDate"}, {"creationDate"})
in
    expandRecord

Hope this helps.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Omid_Motamedise
Super User
Super User

 

Use the below pattern and replace each part with the desired name or number

 

Tablename[columnname]{row number}[record field name]


If my answer helped solve your issue, please consider marking it as the accepted solution.

View solution in original post

Anonymous
Not applicable

Hi @MatheusGuzman ,

 

You could add a costom column by this formula

=[status]{0}[creationDate]

I've made a test for your reference:

vbofengmsft_0-1732602936167.png

 

 

 

Best Regards,

Bof

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @MatheusGuzman ,

 

You could add a costom column by this formula

=[status]{0}[creationDate]

I've made a test for your reference:

vbofengmsft_0-1732602936167.png

 

 

 

Best Regards,

Bof

Omid_Motamedise
Super User
Super User

 

Use the below pattern and replace each part with the desired name or number

 

Tablename[columnname]{row number}[record field name]


If my answer helped solve your issue, please consider marking it as the accepted solution.
PwerQueryKees
Super User
Super User

From the UI, Hit the Add Custom Column, choose the new column name and use [Status]{1} as the formula

 

This is what it will look like in tghe formula bar:

= Table.AddColumn(#"Tipo Alterado", "StatusCreation", each [Status]{1})

jgeddes
Super User
Super User

You can use the Table.TransformColumns function to work within the lists in the status column. 
a sample would look like...

= Table.TransformColumns(duplicateStatusList, {{"creationDate", each List.First(List.Select(_, each Record.HasFields(_, "creationDate")))}})

In this function, for each row in the table (table is named 'duplicateStatusList' here) in the 'creationDate' column select the first value in the list of records that have 'creationDate' as the header.

You can then expand the resulting record in the 'creationDate' column.

Here is a complete example code you can paste into the advanced editor of a blank query.

let
    Source = 
    #table(
        {"ticketID", "status"}, 
        {
            {10, {[id="31"], [creationDate=#date(2024,11,21)], [action=7]}},
            {9,{[id="32"], [creationDate=#date(2024,11,22)], [action=6]}}
        }
    ),
    duplicateStatusList = Table.AddColumn(Source, "creationDate", each [status]),
    selectFirstCreationDate = Table.TransformColumns(duplicateStatusList, {{"creationDate", each List.First(List.Select(_, each Record.HasFields(_, "creationDate")))}}),
    expandRecord = Table.ExpandRecordColumn(selectFirstCreationDate, "creationDate", {"creationDate"}, {"creationDate"})
in
    expandRecord

Hope this helps.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





m_dekorte
Resident Rockstar
Resident Rockstar

Hi @MatheusGuzman 
There are a couple of ways to achieve this, depening on your specific needs:
List.First or List.Last will get you the first or last record from the list in the status field
alternatively you can use optional item access to extract an item on its zero-based index position and optional field access, here's what that could look like. 

Pick one of these lines of code and paste them into the formula area of the Custom Column dialog:

List.First([status])[creationDate]?

List.Last([status])[creationDate]?

[status]{1}?[creationDate]?

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.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.