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
operator
Frequent Visitor

New table / query based on existing query

Hi, still new to Power BI migrating from Power Query.

 

In Power Query we have the capability to use existing query / table and build new query / table. But it doesn't seem to work in Power BI: I can't refer to an earlier query when adding a new source. In new table, I don't know what to type to get it. 

 

The goal is to unpviot a few columns but not the rest, which is needed for other reporting purposes.

 

Thanks in advance.

 

Michael

1 ACCEPTED SOLUTION
pqian
Microsoft Employee
Microsoft Employee

@operator, PowerBI Desktop uses PowerQuery internally, so the capabilities are almost identical (Save a few Excel related features)

 

You can refer to another query by their name, for example, starting from a Blank Query, type

= Query1

 

that will refer to an existing query called "Query1"

 

 

View solution in original post

10 REPLIES 10
abond
Frequent Visitor

I believe a problem I'm having is very similar to that of the original poster, however the proposed solution does not quite solve my problem. 

 

Let's say my original table is loaded into the Query Editor with columns:  | ID | A | B | C | X | Y | Z |

 

I would like to create a 2nd table with only columns: | ID | X | Y | Z |
(perhaps by duplicating the entire 1st table and then deleting unnecessary columns | A | B | C | )

 

I would then like the 1st table to end up with only columns: | ID | A | B | C |
(i.e. simply deleting columns | X | Y | Z | ).  Therein lies the problem:  this deletion of columns in the 1st table must happen AFTER the 2nd table has been created.

 

Suggestions?

MarcelBeug
Community Champion
Community Champion

Yes, create a third query.

 

Additionally you may want to uncheck "Enable Load" for your first table that has all columns.

 

Specializing in Power Query Formula Language (M)

I believe you're recommending that I load the data twice from the source, and that is what I'm doing currently, but it's inefficient and undesirable due to the volume of data.

 

My ideal solution would involve loading the data once then duplicating within the Query Editor. 🙂

Anonymous
Not applicable

Look into the create calculated tables: https://powerbi.microsoft.com/en-us/guided-learning/powerbi-learning-2-6-create-calculated-tables/

 

It looks like the functions being used are referred to as DAX functions. A quick google search for DAX functions brings you to Microsoft's library of DAX functions. I think you want a filter function like allexcept(): https://msdn.microsoft.com/en-us/library/ee634795.aspx

 

 

pqian
Microsoft Employee
Microsoft Employee

@operator, PowerBI Desktop uses PowerQuery internally, so the capabilities are almost identical (Save a few Excel related features)

 

You can refer to another query by their name, for example, starting from a Blank Query, type

= Query1

 

that will refer to an existing query called "Query1"

 

 

Thanks @pqian! Another dumb question: if the earlier query has space, how do I refer it?

pqian
Microsoft Employee
Microsoft Employee

@operator You can qualify identifiers by using the #"" escape

 

e.g.,

=#"Query 1"

emoroz
Frequent Visitor

Source=#"Query Name"

 

How do I make the query name a variable based on a cell selection? 

 

Below TemplateType is the name of query loaded into table. The custom function loads that query into another query. I want to do the same thing except I don't want the data to be loaded into a table. 

 

Excel.CurrentWorkbook(){[Name=TemplateType]}[Content]

pqian
Microsoft Employee
Microsoft Employee

BTW, if you right click on "Query1", you can pick "Reference Query" from the context menu to do exactly this

Lovely! That's even easier! Gee I should've asked earlier here than finding the solution for many hours in Google.

 

Thanks again for your help!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors