Forum Discussion
Anonymous
7 years agoNot applicable
[Power Query] Check which column names equal a [Column] for a conditional column
Hi, I can´t figure out this. I´ve looked in the forum but didn´t found an answer either. Given a table like this: I´d like to check which [Year] equals to a column name in the table, and then...
- 7 years ago
Hi Anonymous
First add an Index Column Starting from 0
Then you can use this Custom Column from Query Editor
=let mycolumn=Text.From([Year]) in Table.Column(#"Added Index",mycolumn){[Index]}*[Value] - 7 years ago
SureAnonymous
Let me tell you first that there is an even easier solution which doesn't even require to Add an Index Column.
Sorry it didn't occur to me first
Just Add this custom column. It should give you desired result
=Record.Field(_,Text.From([Year]))*[Value]
_ gets you the current row record. Second argument is the fieldname from which you want to fetch the value
https://docs.microsoft.com/en-us/powerquery-m/record-field
Zubair_Muhammad
7 years agoCommunity Champion
Hi Anonymous
First add an Index Column Starting from 0
Then you can use this Custom Column from Query Editor
=let mycolumn=Text.From([Year]) in
Table.Column(#"Added Index",mycolumn){[Index]}*[Value]