Clicky

Data Cleanup Made Easy: Replacing (Blank) with Null in Power BI

how-to Jan 30, 2024
Profile Image
Hi, I'm Tom Blessing. I'm an expert at helping small to mid-sized companies adopt Power BI. I'm also a recovering investment banker, with deep experience applying technology to otherwise manual data problems. I have dual degrees in Finance and Technology Management from Indiana University.

Resources to help build your fundamentals: Learning Power BI? Data fundamentals are critical for this process to be easier. I've assembled a few DataCamp courses to help. I earn a small commission if you click and purchase.

Introduction to Power BI course: Master Power BI basics and learn to build impactful reports.

Exploratory Data Analysis in Power BI course: Learn about Power BI's Exploratory Data Analysis (EDA) and enhance your reports.

Introduction to SQL course: Learn how to create and query relational databases using SQL in just two hours.

Introduction to DAX course: Learn the fundamentals of Data Analysis Expressions (DAX) such as calculated columns, tables, and measures.

Database Design course: Learn to design databases in SQL to process, store, and organize data in a more efficient way.


Data quality is important in any data analysis project, and Power BI provides various tools to help you clean and prepare your data.

One common data cleaning task is replacing empty or blank values with nulls, which can improve your data accuracy and facilitate analysis.

Here are a couple ways this could manifest itself:

  • Your data could have an actual value of "(blank)" in a column. In a twist of irony, Power BI will consider this to be actual data instead of the intended empty cell.
  • Your data could have actual blanks or "holes" in a column. Power Query Editor will automatically show 'null' in this case, but 'null' will not be an actual value. It's sort of a placeholder value that is excluded from calculations. The holes will be apparent back in Power BI Desktop.
  • Your data could have the value "null". As in the first case, Power BI treats this as actual data.

In this blog post, we'll explore how to replace blank values with nulls in Power BI, making sure your data is ready for meaningful analysis. 

The Importance of Data Cleanup

Inconsistent or missing data can lead to inaccuracies in your analysis, impacting the quality of your insights and decisions.

Cleaning your data is a crucial step to make sure that your Power BI reports and visualizations provide reliable and actionable information.

 

Replacing (Blank) with Null in Power BI

To replace blank or empty values with nulls in Power BI, you can use Power Query, a data transformation tool built into Power BI. Here's how to do it:

  1. Load Your Data: Import your data into Power BI by connecting to your data source. This could be a CSV file, database, Excel workbook, or any other supported data source.

  2. Open Power Query Editor: In Power BI Desktop, go to the "Home" tab and click on "Transform Data" in the Queries section of the Home Ribbon. This opens the Power Query Editor, where you can perform data transformations.

  3. Select the Column: In the Power Query Editor, select the column or columns where you want to replace blank values with nulls.

  4. Use the "Replace Values" Transformation. This is useful when there are values of "(Blank)" or "null" in your dataset. It can also be used when there are actual blanks in your dataset.

    • When there are actual values of "(Blank)":
      • With the column(s) selected, go to the "Transform" tab in the Power Query Editor.

      • Click on the "Replace Values" option.
      • Configure the Replacement:

        • In the "Replace Values" dialog box, enter (Blank) in the "Value to Find" field.
        • Leave the "Replace with" field empty.
        • Click "OK" to apply the replacement.
    • When there are values of "null":
      • Same as when there are values of "(blank)"
    • When there are actual blanks in your data set:
      • With the column(s) selected, go to the "Transform" tab in the Power Query Editor.
      • Click on the "Replace Values" option. 
      • Configure the Replacement:

        • In the "Replace Values" dialog box, leave the "Value to Find" field empty
        • Enter a value like "null" in the "Replace with" field.

 

        • Click "OK" to apply the replacement.
  1. Apply Changes: Once you've configured the replacement, click the "Close & Apply" button in the Power Query Editor to save the changes and load the data into Power BI.

  2. Review the Data: After applying the changes, review your data in Power BI to make sure the outcome you wanted is achieved.

 

Benefits of Replacing (Blank) with Null

  1. Data Consistency: Replacing blank values with nulls ensures consistent data representation, making it easier to work with and analyze your data.

  2. Accurate Calculations: Null values are typically excluded from calculations, ensuring that your aggregations and calculations are accurate and meaningful.

  3. Improved Data Quality: Clean data with consistent null values enhances the overall quality of your reports and visualizations.

  4. Facilitates Data Analysis: Null values are recognized as missing data, allowing you to apply appropriate data analysis techniques and visualizations.

 

Conclusion

Cleaning your data is a fundamental step in the data analysis process, and replacing blank values with nulls in Power BI is a straightforward yet essential data cleanup task.

By following the steps outlined in this guide, you can ensure that your data is ready for meaningful analysis, providing accurate insights and supporting data-driven decision-making in your organization.

 

Read more:
iNsync: Set Up Power BI Automatic Refresh with Excel
Lights, Camera, Insights: Compare Power Platform vs Power BI
The Data Tango: How to Connect Sharepoint Excel to Power BI
Troubleshooting Checklist: Power BI Desktop Not Updating
How To Guide: (Power BI) Use Date Without Hierarchy

Download My Free Guidebook

The 3-Step Plan for Getting Started With PowerBI

Learn the best way I've helped large and small companies adopt the best analytics tool you've ever seen. In this FREE guide, I'll show you my complete startup strategy for Power BI.

We hate SPAM. We will never sell your information, for any reason.