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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
pruvieros
Frequent Visitor

Error when applying a query to Power BI (cannot convert the value null to type Table)

Hello,

 

I'm trying to export  all tables names and all column names from Power Query to a csv file

 

I found the very powerful keyword #shared in the radacad website, that allows to get a list of all Tables and Functions in Power Query.
https://radacad.com/power-query-library-of-functions-shared-keyword


Then this list can be transformed into a table by clicking on the button "To table"

Then, it is easy to add to this table a custom column that will include all columnn names of each table.

The last step is to expand this custom column ("Expand to new rows")

 

Everything works fine as long as I am in Power Query

 

But when I want to Apply this query in order to get back to Power Bi, I get the message:
"Error OLE DB or ODBC: [Expression.Error] We cannot convert the value null to type Table"

 

However, I have no null value in my table!!!!

 

Do you have an idea?

 

In order to reproduce  the problem, you can use the following procedure

1- Create a csv file named "sample.csv" with the following information:

Product;Price
Apple;10
Banana;20

2- Import it in Power Query

3- Add a blank Query with the keyword #shared (in the advanced editor, delete all other keywords), then click OK

pruvieros_7-1638018013574.png

4- Transform it to a table with the button To Table. You should get a table with 2 columns named "Name" and "Value"

5- Filter the lines so that the only one remaining is the one with the name of your table (the table imported from the csv file)

pruvieros_2-1638017293072.png

6- Add a custom column with the instruction =Table.ColumnNames([Value])

(In this step, I assume that the name of the second column is "Value")

pruvieros_5-1638017707668.png

 

pruvieros_3-1638017514992.png

7- Expand this custom column by clicking on the button in the header.

pruvieros_6-1638017791867.png

8- Try to "Close and apply".

Do you get an error message?

1 ACCEPTED SOLUTION

You don't need a license to run DMV queries against the PBIX file  (for example with DAX Studio). Only requirement is that the PBIX is opened with Power BI Desktop.

View solution in original post

3 REPLIES 3
pruvieros
Frequent Visitor

Hello lbendlin,

Thanks for your reply and for your example file.

 

I am currently using the Pro version of Power BI, so I don't have access to DMV queries.

 

In the process I described above, the purpose of the keyword #shared is to automatically get ALL table names of my pbix file (and then to automatically apply on those tables the function Table.Names)

I've presented an example as simple as I could, but in fact,  I'm using pbix files with many tables, each of them containing many columns, and I'm looking for a solution to automatically get the list of ALL tables with ALL columns of those tables (if possible from within Power Query).

 

It seems to me that the  keyword #shared is an easy way to get the names of all tables, but I am very interested if you know a better way to do it!

Thanks in advance

 

Pruvieros

You don't need a license to run DMV queries against the PBIX file  (for example with DAX Studio). Only requirement is that the PBIX is opened with Power BI Desktop.

lbendlin
Super User
Super User

You don't really need to use #shared.  Easier to use Table.ColumnNames() or other meta functions.  Or use DMV queries.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors
Top Kudoed Authors