Power Query Duplicate Initializer

cr731

Well-known Member
Joined
Sep 17, 2010
Messages
611
In Power Query, is there any way to lead multiple statements with the same variable name?

Here is an example,

Code:
let
   MyTable = Access.Database(...)
   MyTable = Table.SelectRows(MyTable, each [ColumnToFilter] = "FilterValue")

in

   MyTable


Basically, I want to import a table and make changes to it, without having to create a new "MyTable" string at the start of every line.

But if I try the above code, I get a "Duplicate Initializer" error.

Just wondering if there is a better way to write M code in a situation like this.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi
You cannot use definition of MyTable variable twice. The Power Query language is not VBA;)
Please, use
Code:
let
   MyTable = Access.Database(...)
   neededRows = Table.SelectRows(MyTable, each [ColumnToFilter] = "FilterValue")
in
   neededRows
instead
Regards,
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top