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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jmillsjmills
Helper III
Helper III

#shared - can't see data in model (but can in preview)

I recently discovered using the excellent #Shared as a source to pulling back all existing queries in the Power BI report and refer to them.

 

It works well within a simple query, as I can filter this table by the query title im looking for and access this data. 

 

However, when I tweak this same simple #shared query so that it's in a function (with defined variables), I start to get issues. The function works fine in data preview when invoked, but that same data doesn't then show in the model and the function (and reference to #shared) is clearly the root cause.

 

To be more specific, I am trying to use a text string variable to dynamically reference one of several queries in Power BI. Crucially, it needs to be invokable via a custom function (i.e. the value will vary in the given column that is invoking the function). Given a parameter is fixed once set, this is not sufficient.

 

So I have a function that uses a text input variable to indicate the query that should be referred to:

 

 

 

let

#"Table"= (yearQuantity,percentileAmount,metricChoice) as table =>

let

Source = Table.SelectRows(Record.ToTable(#shared), each [Name] = "" & metricChoice & ""){0}[Value]

 

in

 

Source

 

in

 

#"Table"

 

 

 

AND IT WORKS FINE! (I've cut off the rest of the query ultimately)...

 

Let's say I invoke this with variables as needed, in the "Data Preview" window it works fine and returns the data I need.

 

 

 

But when I try to "Close and Apply" my changes, I get an error message loading the invoked function:

 

 

Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [Expression.Error] We cannot convert the value null to type Table.. '

 

 

I also tried loading the #shared table in a query of its own, then refer to that query and manipulating it accordingly. Again this works fine in data preview; it just won't load the data to the model.

 

 

 

I hope my issue is clear as I would love some much-needed help!! Thank you 

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors
Top Kudoed Authors