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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Andrew_lu1933
Regular Visitor

How to set var to select column name?

in power query, if I want to operate one column, we will  use _[columnName].

but if I want operate many column, I want use List.Transform({columnName1, columaname2},(t)=> operate(Table, [t]).

how to pass columnName var to operator this column?

4 REPLIES 4
wdx223_Daniel
Super User
Super User

List.Transform({Column1,Column2},each List.Sum(Table.Column(tbl,_)))

watkinnc
Super User
Super User

You can try

 

each (row)=> List.Tranform({row[Column1], row[Column2]}=> operate(Table, [t]))

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

[t]  , the t is only as a str, not as a var.

Vijay_A_Verma
Super User
Super User

If you can explain what exactly you are trying to do, then experts here can suggest the right solution. 

When you are doing List.Transform({columnName1, columaname2},(t)=>, it is t which contains columnName1 & 2 one by one and whatever you are operating on t will be applicable on columnName1 & 2.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors