cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

Combine different database tables

I have two identical databases for separate company

I need combine (not join!!) each same_name tables in this two databases

 

How i can do that in M?

 

Now for one database i do something like

 

let
Source = Sybase.Database(SelectServer, SelectDatabase),
DBA_view_DidknObj = Source{[Schema="DBA",Item="view_DidknObj"]}[Data]
in
DBA_view_DidknObj

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Combine different database tables

Hi @Analitika ,

 

The 'otherSteps' lines were just placeholders to represent further transformation steps if you needed to do them, such as 'Changed Types' etc. They are not necessary but show that you must use the last step in each Source segment in the Table.Combine() function.

 

The data source privacy levels are something that you need to resolve at your end. If these sources are already set up in Power Query, you can try going to Data Source Settings and check that both data sources have the same privacy levels i.e. None, Private, Organisational, or Public.

 

Pete

View solution in original post

10 REPLIES 10
Highlighted
Super User IX
Super User IX

Re: Combine different database tables

@Analitika , You mean append? refer

 

https://radacad.com/append-vs-merge-in-power-bi-and-power-query



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Post Prodigy
Post Prodigy

Re: Combine different database tables

I mean Table.Combine

Highlighted
Super User IX
Super User IX

Re: Combine different database tables

@Analitika , that should be the same as append option in menu?

Can you share a few lines of sample data and sample output in table format?



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Post Prodigy
Post Prodigy

Re: Combine different database tables

If i do like that i will have 4 database sized in one pbix file, but i want to have 2 database sized file

 

1st database  = 700 Mb

let
Source = Sybase.Database(SelectServer, SelectDatabase1),
DBA_view_DidknObj = Source{[Schema="DBA",Item="view_DidknObj"]}[Data]
in
DBA_view_DidknObj

 

2st database  = 700 Mb

let
Source = Sybase.Database(SelectServer, SelectDatabase2),
DBA_view_DidknObj = Source{[Schema="DBA",Item="view_DidknObj"]}[Data]
in
DBA_view_DidknObj

 

Combined database  = 1400 Mb

let
Source = Table.Combine({#"DBA 1", #"DBA 2")"})
in
Source

 

Total = 700+700+1400 = 2800 MB

I need only 1400 MB

Highlighted
Super User IX
Super User IX

Re: Combine different database tables

@Analitika , I am confused now. If you are looking file size. That the size is the first two tables + one combined table.

 

Created a copy of pbix file and try to delete the source table after combining it. and check. Please keep backup.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Super User II
Super User II

Re: Combine different database tables

Hi @Analitika ,

 

You can do this in a single query so you're not holding all the tables. Something like:

 

let
  Source1 = Sybase.Database(SelectServer, SelectDatabase1),
  DBA_view_DidknObj1 = Source1{[Schema="DBA",Item="view_DidknObj"]}[Data],
  otherSteps1 = otherSteps,

  Source2 = Sybase.Database(SelectServer, SelectDatabase2),
  DBA_view_DidknObj2 = Source2{[Schema="DBA",Item="view_DidknObj"]}[Data],
  otherSteps2 = otherSteps,

  Append = Table.Combine( {otherSteps1, otherSteps2} )
in
  Append

 

 

Pete

Highlighted
Post Prodigy
Post Prodigy

Re: Combine different database tables

 already tryied, it provide errors as no linking table exists

Highlighted
Super User IX
Super User IX

Re: Combine different database tables

@ImkeF , what is the best way to comine and have a minimum size?



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Post Prodigy
Post Prodigy

Re: Combine different database tables

@BA_Pete 

Expression.Error: The name 'otherSteps' wasn't recognized. Make sure it's spelled correctly.

Expression.Error: The import otherSteps matches no exports. Did you miss a module reference?

Formula.Firewall: Query 'DBA view_DidknObj' (step 'Append') is accessing data sources that have privacy levels which cannot be used together. Please rebuild this data combination.

 

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors