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
primolee
Helper V
Helper V

Record.Field Error

Hello everyone,

 

I want to use the value in column M1 as column name and extract the value in that column.

 

= Table.AddColumn(#"Previous Step", "Custom", each if ([M1]=null) then [Cue Final Key] else [Cue Final Key]&"|"&Record.Field(_, [M1]))

 

However, error shows:

Expression.Error: Cannot find the column 'Period'

 

RecordFieldError.jpg

 

Funny thing is, I have another query with very similar step and the same column name, and it works.

 

The only difference between these two queries is that the one not working has merge step.

 

Does anyone have any idea what is wrong with my query?

 

Thank you very much in advance.

 

Best regards,

David

1 ACCEPTED SOLUTION
primolee
Helper V
Helper V

Somehow it is not a stable function...

 

My solution is to add a new column with Record.FieldNames(_), then add the next new column using the above code, it will work with 2 steps...

 

I guess you "sometimes" need to let the system get all column names in a list first, or else the system will not recognize all column names.  Sometimes you don't need it, sometimes you do.

 

Hopefully Microsoft can look into this. 😞

View solution in original post

3 REPLIES 3
primolee
Helper V
Helper V

Somehow it is not a stable function...

 

My solution is to add a new column with Record.FieldNames(_), then add the next new column using the above code, it will work with 2 steps...

 

I guess you "sometimes" need to let the system get all column names in a list first, or else the system will not recognize all column names.  Sometimes you don't need it, sometimes you do.

 

Hopefully Microsoft can look into this. 😞

Hi @primolee 

When using a code as below:

Record.Field(previous step,"M1" )

It would retrieve values from column[M1] into a list nested as a cell of the column.

Capture1.JPG

If your solution works, please use it.

Here is a video introducing how to get columns' name from columns' values dynamically.

https://community.powerbi.com/t5/Desktop/Dynamic-column-name-from-its-value/td-p/189442

 

Best Regards

Maggie

\ddd

Hello @v-juanli-msft ,

 

Thanks for your reply.  Unfortunately, I only need the value of the field corresponding to the same row, this is why I use Record.Field(_, [M1]), _ underscore sign instead of #"Previous Step".

 

I have found somewhat a solution just right before your reply.

 

Sometimes it works just with Record.Field(_, [M1]), sometimes I need to create a new column using Record.FieldNames(_) first then another new column with Record.Field(_,[M1]) in order to recognize all field names.  This is very strange, but anyway... (>_<)

 

Thank you for the help!

 

Best regards,

David

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.

Top Solution Authors
Top Kudoed Authors