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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Chris99
Advocate III
Advocate III

Add missing tables from data source to existing dataset

Hello,

 

Is it possible to add tables from a data source (SQL Server) that weren't initially imported into a dataset?

 

I thought that in the Desktop I had seen a view that looked like the Navigation page when you initially select Enter Data, that allowed you to tick or untick tables from the existing dataset, but I might have imagined it Smiley Frustrated

 

Thanks,

 

Chris

2 ACCEPTED SOLUTIONS
Stachu
Community Champion
Community Champion

when you first connect and select multiple tables each table is actually created separately, the easy way to edit it is to go to Query editor 

 

the easiest way to add new table is to add new data source (no need to go to Query Editor at all). I think you will see all the tables there, so you could possibly load the same table twice, but that's easy to fix
Capture.PNG



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

Stachu
Community Champion
Community Champion

I think so, I didn't use the data gateways much
you can see the dependencies in the query editor, inthe View Tab
Capture.PNG

I expect you to see your DW at the top with arrows pointing to multiple tables (regardless whether they were created in the begining or added later)

 

You can review the M code that got generated for different tables in Advanced Editor in the Home tab, so you can compare it for  the original and added tables - top 2 rows should be identical (if it's all same database)

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

11 REPLIES 11
Stachu
Community Champion
Community Champion

you just create a new query as a connection to SQL Server and you will have the same interface again



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

@StachuHi. How do you create a new one? Presumably it is in Edit Queries, but I can only see how to modify an existing one.

 

Is there no easy way to see which tables I haven't imported?

 

Chris

Stachu
Community Champion
Community Champion

when you first connect and select multiple tables each table is actually created separately, the easy way to edit it is to go to Query editor 

 

the easiest way to add new table is to add new data source (no need to go to Query Editor at all). I think you will see all the tables there, so you could possibly load the same table twice, but that's easy to fix
Capture.PNG



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Thanks for replying. Does this mean I would have two datasets, as forum posts suggest this can increase refresh issues?

 

Thinking about it, it just sounds easier to duplicate an existing query, and then modify it to import from a different table. It does seem like a bit of a long winded way though. I might make a suggestion on Power BI ideas.

 

Chris

Stachu
Community Champion
Community Champion

both ways have the same result. M query with syntax similar to his one:

let
    Source = Sql.Databases("server addres"),
    #"DW" = Source{[Name="DW address"]}[Data],
    dimTable = #"DW"{[Schema="dbo",Item="TableName"]}[Data]
in
    dimTable

whether you will do it by copying existing query, or adding "new" data source etc. it doesn't matter, it's just a different way of achieving the same outcome

PowerBI will treat each table as a separate query in the same dataset

if you work with multiple environments I would suggest to split the process a bit to something like this
Query SQL_Connection (connection to SQL server that is then referenced by all the tables)

let
    Source = Sql.Databases("server addres"),
    #"DW" = Source{[Name="DW address"]}[Data]
in
    #"DW"

Dimension1 (referencing previous query)

let
    Source = SQL_Connection,
dimTable1 = #"DW"{[Schema="dbo",Item="TableName"]}[Data]
in
dimTable1

 

Dimension2

 

let
    Source = SQL_Connection,
dimTable1 = #"DW"{[Schema="dbo",Item="TableName"]}[Data]
in
dimTable2

 that way you only need to update the server address in one query (e.g. when switching from DEV to QA or PROD), and whenever you need to add a new table you just reference SQL_Connection and navigate to the new table



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

@StachuAah, does that mean if I do a second Get Data whick looks at the same data source as my existing dataset, then the new tables are added to the exisitng dataset exactly the same as if they were included in the Get Data initially ? If so, then for a scheduled refresh through a data gateway will all the queries run in the same manner, irrespective of the number of Get Datas that were run when creating the dataset?

 

Thanks again,

 

Chris

Stachu
Community Champion
Community Champion

I think so, I didn't use the data gateways much
you can see the dependencies in the query editor, inthe View Tab
Capture.PNG

I expect you to see your DW at the top with arrows pointing to multiple tables (regardless whether they were created in the begining or added later)

 

You can review the M code that got generated for different tables in Advanced Editor in the Home tab, so you can compare it for  the original and added tables - top 2 rows should be identical (if it's all same database)

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

@StachuThanks. I'll accept this as the solution Smiley Happy

Stachu
Community Champion
Community Champion

glad to help 🙂



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

A bit late to the party, but there is a much quicker option IMO where you do not have to enter any details about server etc.

 

  • Open Query Editor
  • Select an existing query and go to the first step Source, this will give you a list of all tables in the source
  • Right-click the table you want to add and select "Add as New Query"
  • Done!

    Frede_0-1611932105186.png


Anonymous
Not applicable

Thanks, helped a lot.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors