cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
intrasight
Helper IV
Helper IV

how to reference named table in a query?

 

 

I am migrating the standard "parameter table function" that uses an Excel workbook to instead use a named table. My table is named "Parameters". My function is:

 

(ParameterName as text) =>
let
ParamRow = Table.SelectRows(Parameters, each ([Name] = ParameterName)),
Value=
if Table.IsEmpty(ParamRow)=true
then null
else Record.Field(ParamRow{0},"Value")
in
Value

 

But this error is reported:

An error occurred in the ‘’ query. Expression error: The name 'Parameters' wasn't recognized. Make sure it's spelled correctly.

 

So clearly I don't understand how to reference named tables in Power Query. What am I missing?

Thanks

1 ACCEPTED SOLUTION

You should be able to make the reference as you're describing. I would double check for case and extraneous whitespace (trailing spaces are never fun). If these check out, would you be able to share a sample .pbix (hosted publicly on OneDrive or similar) that recreates the issue for us to look at, please?

View solution in original post

8 REPLIES 8
pqian
Microsoft
Microsoft

By "Named Tables" do you mean a table in your Excel workbook? PowerQuery (M language) cannot directly interact with Excel's objects. You need to import the workbook and then operate on the imported Query.

Hi,

I have a query named "Parameters". It is of type "table" (has table icon in query sidebar). It was created with the new "Enter Data" feature.

Thanks,

Chris

 

beedeagle
Frequent Visitor

It may recognize the query as table in M formula. Try to create another query of the current Parameters table, then name the query to "Parameters".

 

The parameters table is a query. The query name is "Parameters". It is of type "table"

You should be able to make the reference as you're describing. I would double check for case and extraneous whitespace (trailing spaces are never fun). If these check out, would you be able to share a sample .pbix (hosted publicly on OneDrive or similar) that recreates the issue for us to look at, please?

Ok. I'll make one from scratch and if it still doesn't work I'll post it online.

The one I made from scratch worked fine. So either I had typo or I had used a reserved keyword. Where are the reserved keywords documented?

So this function references an object (table?) called Parameters. Is that loaded in your data model already?  I have never used functions in Power BI. I assume they work - not sure. 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors