top of page
Writer's pictureRenji Kuriakose

“Data Cleaning Made Easy: Elevate your skills with power query”

Data cleaning is essential to prepare raw data into structured and organized format suitable for data analysis. Data cleaning is a creative and time-consuming process. It tickles our imagination and makes us find the most interesting solutions for the data issues that we encounter.

Power Query is an ETL tool created by Microsoft for data extraction and transformation. It simplifies the data cleaning and analysis of data by the process of importing, cleaning, and reshaping data from various sources. It offers an easy interface for users to combine and refine data. By using Power Query, users can automates data preparation tasks, save time in data cleaning, and ensure consistent data analysis.

Clean Messy Data with these power query Techniques

Formatting and Standardizing Data

Power Query provides different ways to help shape data. One of the options is formatting text columns. We often need to clean our text columns because they contain text randomly. In such cases, data cleansing includes removing unnecessary spaces in data, capitalizing necessary words in the text field, and so on.

Handling missing values

Power query has very useful features to deal with missing values; it has options like Replacing values, Fill up, Fill down, or removing rows. In the power query editor under data preview, there is an amazing option to check the column quality, at the top of each column it will summarize what percent of values are valid, contain formula errors, and are empty.

Removing Blank Rows and Columns

Power Query provides options to remove blank rows and columns from a dataset, ensuring data cleanliness.

Merging Columns

In the power query editor under the transform tab, there is an option ' merge columns' to integrate multiple columns.

Change type

The change type option in the power query is an effective cleaning step, it can be used to change the data type of the columns

Data Validation and Quality Checks

Power Query enables users to perform data validation and quality checks by applying rules or conditions to the data. without the need for advanced formulas. This helps in fixing data quality issues.


Image Source:https://images.unsplash.com/photo-1640158615573-cd28feb1bf4e?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=claudio-schwarz-fyeOxvYvIyY-unsplash.jpg

Let's Analyze our dataset

Here we are analyzing the global superstore dataset using Power Query, This dataset has 51,290 rows and 26 columns.

Go to the home tab on the top ribbon and click Transform data


Image by Author

Choose Columns option in the top ribbon of the query editor window can be used to choose the columns you want to keep in your table to analyze data.

Remove Columns option can be used to remove the selected columns or you can remove all other columns rather than the selected one.

Keep Rows and Remove Rows options allow you to manage your rows of the dataset according to your analysis.

Split columns we can also split columns by using delimiters.


Image by Author

Remove Duplicates option in the power query is an excellent feature for removing duplicates.


Image by Author

Advanced Techniques  In Power Query

In addition to the basic transformations, Power Query offers advanced techniques for data handling and manipulation.

Custom Column: Power Query enables users to create custom columns based on calculations. This is useful for performing complex calculations or creating calculated fields.

Image by Author

Date and Time Functions: It provides a range of functions to handle date and time data, such as calculating the difference between dates, extracting parts of a date, and formatting dates.

Handling Exceptions and Errors: It offers error-handling capabilities, helping users handle errors and exceptions during data transformations. Users can define custom error-handling logic or skip rows with errors.


Image by Author

Advanced Data Transformations: It supports advanced data transformations like grouping (example: Group by) aggregating data, unpivoting multiple columns, and performing advanced calculations using DAX formulas.

Group By: This function enables you to perform various operations like counting, summing, or Averaging data within specific groups. You can perform this step by right clicking on the category column and selecting Group by from the ribbon, then select count rows from the operation and click ok. This operation summarizes data by showing the count of rows based on each category.


Image by Author


Image by Author

If we select Average as operation and sales as column it will return the average profit for each type of category. In the same way, we can perform other operations like Sum, Maximum, Minimum, and so on


Image by Author
Image by Author

Power Query Data Sources

Power Query supports various data sources for importing and manipulating data. Here are some examples:

Importing Data from Excel: It allows users to import data from Excel files, including multiple sheets and named ranges.

Connecting to Databases: Power Query supports connecting to databases like SQL Server, Oracle, MySQL, and more. Users can import data from tables, views, or custom SQL queries.

Web Scraping with Power Query: It provides web scraping capabilities, allowing users to extract data from web pages by specifying the HTML elements to scrape.

API Integration with Power Query: Power Query supports integration with APIs, enabling users to import data from web services by specifying the API endpoints and parameters.

Working with Cloud Storage Services: It allows users to connect to cloud storage services like Azure Blob Storage, SharePoint, OneDrive, and Google Drive to import data.












Conclusion

Power Query is a powerful and advanced tool for data manipulation and cleaning. It offers a wide range of techniques to extract, transform, and load data from various resources. By following best practices and leveraging the capabilities of Power Query, users can efficiently clean, transform, and analyze data to gain valuable insights for business. So, start exploring Power Query and unlock the full potential of your data.


Thanks for reading!!!




109 views

Recent Posts

See All
bottom of page