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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
prontonz
Regular Visitor

Power Query - get value of a column where the column is an occurrence in a list of column names

Situation is I have defines a list of columns names (LISTCOLUMNS), e.g. Name0, Name1, Name2, Name3, Name4.
For any given row, I know which column name I need and have established the index 1 through 4.
For example,
Row 1 has Index 3 and therefore needs to get the value of Name3,
Row 2 has index 1 and therefore needs to get the value of Name 1.

This formula
= Table.AddColumn(#"Added Custom2", "Custom1", each [ListColumns]{0}) will retrieve the column text "Name0" but not the value for the value of Name0 in that row.

How can I achieve this?

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Use this

= Record.Field(_,[ListColumns]{0})

 

View solution in original post

2 REPLIES 2
Vijay_A_Verma
Super User
Super User

Use this

= Record.Field(_,[ListColumns]{0})

 

Perfect - thank you Vijay!.  

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Kudoed Authors