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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Iohanney
Regular Visitor

Visualize in stacked bar chart the missing percentage of every column.

Hello!

 

I would like to show on one stacked bar chart the missing values (null) percentage of every column for data quality purposes.

 

1. Tried to Unpivot the table and calculate the blank and the total for the attributes column, but it doesn't work.

2. Than tried to transpose the table and count the blank values per row: List.Count(List.Select(Record.FieldValues(_), each _ = "" or _ = null)), but it gives an error (The syntax for 'Count' is incorrect. (DAX(List.Count(List.Select(Record.FieldValues(_), each _ = "" or _ = null)))).

 

 

Thanks in advance

1 ACCEPTED SOLUTION
v-veshwara-msft
Community Support
Community Support

Hi @Iohanney ,
Thanks for posting in Microsoft Fabric Community,

To visualize the missing/null percentage for each column, please refer to the steps below.

I created a sample dataset and reproduced the expected result

  1. Created sample data manually using "Enter Data" in Power BI with columns like ID, Name, Age, City, and Score.
    Some values were left blank to simulate missing data.

    vveshwaramsft_0-1747586754215.png

     

  2. Demoted headers and Transposed the table:

    vveshwaramsft_1-1747586839818.png

     

  3. Added a column to count null or blank values:
    List.Count(List.Select(Record.ToList(_), each _ = null or _ = ""))

    vveshwaramsft_2-1747586959374.png

     

  4. Added a column to count total values:
    List.Count(Record.ToList(_))
    vveshwaramsft_3-1747587048862.png

     

  5. Added a column to calculate the null percentage:
    [NullCount] * 100 / [TotalCount]
    vveshwaramsft_4-1747587169681.png

     

  6. Created a stacked bar chart:

    Y-Axis: Column1

    X-Axis: NullPercent

    vveshwaramsft_5-1747587280392.png

     

Hope this helps. Please reach out for further assistance.
If this post helps, then please consider to give a kudos and Accept as the solution to help the other members find it more quickly.


Thank you.

View solution in original post

6 REPLIES 6
v-veshwara-msft
Community Support
Community Support

Hi @Iohanney ,

We’re following up once more regarding your query. If it has been resolved, please mark the helpful reply as the Accepted Solution to assist others facing similar challenges.

If you still need assistance, please let us know.
Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @Iohanney ,

Following up to see if your query has been resolved. If any of the responses helped, please consider marking the relevant reply as the 'Accepted Solution' to assist others with similar questions.

If you're still facing issues, feel free to reach out.

Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @Iohanney ,

Just checking in to see if you query is resolved and if any responses were helpful. If so, kindly consider marking the helpful reply as 'Accepted Solution' to help others with similar queries. 

Otherwise, feel free to reach out for further assistance.

Thank you

v-veshwara-msft
Community Support
Community Support

Hi @Iohanney ,
Thanks for posting in Microsoft Fabric Community,

To visualize the missing/null percentage for each column, please refer to the steps below.

I created a sample dataset and reproduced the expected result

  1. Created sample data manually using "Enter Data" in Power BI with columns like ID, Name, Age, City, and Score.
    Some values were left blank to simulate missing data.

    vveshwaramsft_0-1747586754215.png

     

  2. Demoted headers and Transposed the table:

    vveshwaramsft_1-1747586839818.png

     

  3. Added a column to count null or blank values:
    List.Count(List.Select(Record.ToList(_), each _ = null or _ = ""))

    vveshwaramsft_2-1747586959374.png

     

  4. Added a column to count total values:
    List.Count(Record.ToList(_))
    vveshwaramsft_3-1747587048862.png

     

  5. Added a column to calculate the null percentage:
    [NullCount] * 100 / [TotalCount]
    vveshwaramsft_4-1747587169681.png

     

  6. Created a stacked bar chart:

    Y-Axis: Column1

    X-Axis: NullPercent

    vveshwaramsft_5-1747587280392.png

     

Hope this helps. Please reach out for further assistance.
If this post helps, then please consider to give a kudos and Accept as the solution to help the other members find it more quickly.


Thank you.

bhanu_gautam
Super User
Super User

@Iohanney Go to the "Transform Data" option in Power BI to open Power Query Editor.
Select your table and add a new column for each existing column to calculate the null count. You can use the following formula in Power Query to calculate the number of nulls in each column:

Table.AddColumn(#"PreviousStepName", "NullCount_ColumnName", each List.Count(List.Select(Record.FieldValues(_), each _ = null)))

 

Add another column to calculate the total number of rows in the table. You can use:

Table.RowCount(#"PreviousStepName")

 

Add a custom column to calculate the percentage of nulls for each column:

Table.AddColumn(#"PreviousStepName", "NullPercentage_ColumnName", each [NullCount_ColumnName] / [TotalRows] * 100)

 

Once you have the null percentages calculated for each column, you can unpivot these columns to create a format suitable for a stacked bar chart.
Select the columns with null percentages and use the "Unpivot Columns" option.

 

Load the transformed data back into Power BI.
Create a stacked bar chart using the unpivoted data. Set the axis to the column names and the values to the null percentages.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






@bhanu_gautam Thanks! The "PreviousStepName" is the table name and where should I put the column name in the first expression?

 

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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