Mastering Data Cleaning and Transformation with Power Query at MavenTech: Part 2

Masego
4 min readApr 30, 2024

--

Welcome back to our series where we’re unlocking the potential of MavenTech’s sales data using Power BI.

Previous Article : Harnessing CRM Data for Insightful Sales Reporting at MavenTech: Part 1

In the first part, we set up our development environment on a Windows VM using Azure. This article delves into Power Query and its role in optimising the data model for our Power BI report, with a focus on using the Import method to load data efficiently.

What is Power Query?

Power Query is a powerful data connection technology that allows you to effortlessly discover, connect, combine, and refine data sources. Integrated within Microsoft Excel and Power BI, Power Query simplifies the data transformation process, making it accessible even for those without coding expertise. It essentially acts as your data-preparation wizard, automating menial tasks so you can focus on deriving insights.

Power Query Editor Window, Source: https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-query-overview

Profiling Data with Power Query’s Data Preview Features

Data Profiling in Power Query Editor, Source: https://exceleratorbi.com.au/data-profiling-in-power-bi/

Before deep-diving into data transformation, it’s crucial to understand your data’s nature. Power Query offers excellent features for profiling your data effectively within the data preview pane. This initial step is essential for identifying potential data quality issues and understanding data distribution, which guides your subsequent cleaning and transformation strategies:

  • Viewing Column Data Statistics: Useful statistics like count, distinct count, min, max, average, and median are available under each column header’s dropdown menu, providing a quick assessment of data range and distribution.
  • Detecting Errors and Empty Values: Automatically highlighted errors and empty cells help pinpoint columns that may require cleansing.
  • Using Filters to Examine Unique Values and Outliers: Filters aren’t just for limiting data load but also serve as powerful tools for data exploration, helping detect outliers and understand data distribution.
  • Column Quality, Distribution, and Value Count Bars: These visual aids show the proportion of valid, error, and empty entries, the distribution of values, and the frequency of data points, respectively, offering a quick snapshot of data quality.

Leveraging these features, you gain a comprehensive overview of your data’s quality and structure, informing the decisions you make during the cleaning and transformation phases.

Optimising Power BI Data Models for Performance: Best Practices

This section examines how Power Query aids in preparing and managing data for our Power BI report, focusing on the Import method for data loading.

1. Data Cleansing and Transformation

  • Removing Unnecessary Columns: Critically assess which data is essential for your analyses and eliminate non-contributory columns.
  • Aggregating Data: Aggregate data at its source to allow Power BI to import only essential summarised information.
  • Filtering Data: Apply stringent filters to exclude irrelevant or outdated historical data.
  • Separating Date and Time Columns: Consider separating date and time components for more efficient storage and processing.
  • Identifying and Removing Duplicates: Remove duplicate rows based on certain keys to prevent skewed analysis.
  • Handling Missing Values: Fill in or remove missing values based on the context, or highlight them as a finding for business consideration.

2. Data Compression

  • Choosing Appropriate Data Types: Opt for Integer over Text wherever possible and avoid bulkier floating-point data types.

A floating point data type is used in programming to store numbers that have fractions (the bits beyond the decimal point), much like most real-world numbers we use every day, such as 3.14, 0.001, or -100.567.

  • Enabling Dictionary Encoding: Use dictionary encoding for columns with repetitive text data to save space and enhance processing speed.

Dictionary encoding is a data compression method that replaces repeated values or words in a dataset with short numeric codes, saving space and speeding up processing.

Conclusion

Power Query has transformed our ability to refine raw data into a polished dataset ready for deep analysis. By automating the cleaning and transformation processes, we ensure our report is built on accurate and analysis-ready data.

Stay tuned for the next article in our series, where we will construct the data model in Power BI and start designing our interactive sales performance dashboard. Remember, a clean and well-structured dataset is the foundation of any insightful BI report!

If you have any questions or tips on data cleaning you’d like to share? Drop a comment below and let’s discuss!

Happy data transforming!

Next Article: Building the Foundation: Designing the Data Model in Power BI : Part 3

Articles in Series:

Harnessing CRM Data for Insightful Sales Reporting at MavenTech: Part 1

Building the Foundation: Designing the Data Model in Power BI : Part 3

A Comprehensive Overview of Designing a CRM Sales Performance Report for MavenTech in Power BI : Part 4

--

--