Power Query How to Load Only Selected Tables in Databse

LarsAustin

New Member
Joined
Feb 27, 2016
Messages
16
Hi All

I'm trying to load only selected fields/columns of a big database. Below is the M code generated:

let
Source = Odbc.DataSource("dsn=hbnav01", [HierarchicalNavigation=true]),
NAVLIVE_Database = Source{[Name="NAVLIVE",Kind="Database"]}[Data],
dbo_Schema = NAVLIVE_Database{[Name="dbo",Kind="Schema"]}[Data],
Darren_ItemCardUpdate_Table = dbo_Schema{[Name="Darren_ItemCardUpdate",Kind="Table"]}[Data]
in
Darren_ItemCardUpdate_Table

This code load all tables. I only want load for example columns named "Item No_" and "Description".

How do I do that.

Thanks

Lars
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Lars

Try something like this.


let
Source = Odbc.DataSource("dsn=hbnav01", [HierarchicalNavigation=true]),
NAVLIVE_Database = Source{[Name="NAVLIVE",Kind="Database"]}[Data],
dbo_Schema = NAVLIVE_Database{[Name="dbo",Kind="Schema"]}[Data],
Darren_ItemCardUpdate_Table = dbo_Schema{[Name="Darren_ItemCardUpdate",Kind="Table"]}[Data],
ItemAndDescription = Table.SelectColumns(_Darren_ItemCardUpdate,{"Item No_", "Description"})
in
ItemAndDescription
 
Upvote 0
Wonderful. Thanks a lot Norie!

Lars

Try something like this.


let
Source = Odbc.DataSource("dsn=hbnav01", [HierarchicalNavigation=true]),
NAVLIVE_Database = Source{[Name="NAVLIVE",Kind="Database"]}[Data],
dbo_Schema = NAVLIVE_Database{[Name="dbo",Kind="Schema"]}[Data],
Darren_ItemCardUpdate_Table = dbo_Schema{[Name="Darren_ItemCardUpdate",Kind="Table"]}[Data],
ItemAndDescription = Table.SelectColumns(_Darren_ItemCardUpdate,{"Item No_", "Description"})
in
ItemAndDescription
 
Upvote 0
Did that actually work?

I'm kind of new with Power Query and was only able to test on an Access database.
 
Upvote 0
Hi Norie,

Your solution is 95% correct. The only thing that I changed is "_Darren_ItemCardUpdate" in "ItemAndDescription = Table.SelectColumns(_Darren_ItemCardUpdate,{"Item No_", "Description"})". I've typed in Darren_ItemCardUpdate.Table instead.

Your help is very much appreciated.

Thanks

Jojie
 
Upvote 0

Forum statistics

Threads
1,225,726
Messages
6,186,669
Members
453,368
Latest member
xxtanka

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