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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
vi_dataanalyst
Regular Visitor

Correct Values in Power Query but Showing as 0 in Power BI

Hello everyone,

 

I am encountering an issue with my Power BI report where the values of a specific column display correctly in Power Query but show as 0 in Power BI. Here are the details:


I used the following code to create a table that counts the number of columns in each table within my data model:

let
// Get the list of all tables in the data model
Model = #sections[Section1],
TableNames = Record.FieldNames(Model),

// Function to count the number of columns in a table
CountColumns = (TableName) =>
let
TableData = Record.Field(Model, TableName),
ColumnCount = Table.ColumnCount(TableData)
in
ColumnCount,

// Create a list of pairs (Table Name, Number of Columns)
TableData = List.Transform(TableNames, each [Nom_Table = _, Nb_colonnes = CountColumns(_)]),

// Convert the list to a table
ResultTable = Table.FromRecords(TableData)
in
ResultTable

 

The table contains two columns:

  • Nom_Table (Table Name)
  • Nb_colonnes (Number of Columns)

In Power Query, I can see both columns with the correct values. However, when I load the data into power BI, the Nb_colonnes column shows only 0s, except when I include the table itself (the table that provides the count of columns per table). For this specific table, the Nb_colonnes values appear correctly in both Power Query and Power BI.

There are no errors during the data load process, and the data type for Nb_colonnes is correctly set to integer.

 

I have tried to verify the data types in Power Query (tried with text and number types), refreshed the data multiple times, checked for any potential issues with the source data and permissions.

table on power query:

FinalTable.png

table on power bi:

tables_power_bi.png

 

tables_2_powerbi.png


Has anyone encountered a similar issue or have any suggestions on how to resolve this?

Thank you in advance for your help!

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @vi_dataanalyst - Can you try with a blank query, to get generate the table with column details as below

 

let
Source = financial,
ColumnCount = Table.ColumnCount(financial)
in
ColumnCount

 

rajendraongole1_0-1723173760679.png

 

 

Can you please try the above . still issue exist, share the sample data  will check it.

 

Hope it helps





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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