How To Clean Data Using Power Query

Power Query To Clean Data in Power BI and Excel

Data cleaning is one of the most critical steps in any data analysis process. Without clean, structured, and reliable data, insights drawn from analysis can be inaccurate or misleading.

In Power BI, Power Query serves as a powerful tool that allows users to connect, transform, and clean data efficiently, ensuring that it’s ready for reporting and analysis.

Whether you’re working with messy datasets from multiple sources, dealing with missing values, or eliminating duplicates, Power Query provides a simple, yet robust interface to clean data with minimal coding.Power Query To Clean Data in Power BI and Excel

In this guide, we’ll walk through a 10-step process to clean data using Power Query, providing clear and actionable instructions to ensure your data is refined and ready for analysis.

10-Step Process to Clean Data Using Power Query in Power BI

  1. Load Data into Power Query
  2. Remove Unnecessary Columns
  3. Rename Columns
  4. Filter Out Unwanted Rows
  5. Handle Missing Values
  6. Change Data Types
  7. Remove Duplicates
  8. Trim and Clean Data
  9. Split and Merge Columns
  10. Apply and Load Data to Power BI

Step-by-Step Process & Details on How to Use Power Query in Excel / Power BI

1. Load Data into Power Query

The first step is importing your data into Power Query. This could be from an Excel file, SQL database, or other data sources.

  • How to do it: In Power BI, click on Home > Get Data. Choose your data source and load the data into Power BI. Then click Transform Data to open Power Query Editor.
  • Purpose: This step allows you to connect Power BI to your data source, bringing raw data into the environment for cleaning and transformation.

2. Remove Unnecessary Columns

Not all columns in your dataset are needed for analysis. Removing irrelevant columns helps streamline the dataset and improve performance.

  • How to do it: Select the columns you don’t need, right-click, and choose Remove Columns.
  • Purpose: This reduces the size of your dataset, making it easier to work with and removing noise that could affect analysis.

3. Rename Columns

Renaming columns improves readability and makes your dataset more understandable, especially when working with multiple datasets or sharing reports with others.

  • How to do it: Right-click the column header and choose Rename. Alternatively, double-click the column name to rename it.
  • Purpose: Clean, descriptive column names make it easier to recognize and use data fields in future transformations and analysis.

4. Filter Out Unwanted Rows

Filtering data ensures that only the relevant rows are kept for analysis. This is particularly useful when you have data entries like errors or outliers that can skew your results.

  • How to do it: Click the dropdown arrow in the column header and apply filters based on conditions (e.g., removing rows with zero values, errors, or irrelevant categories).
  • Purpose: Filtering reduces dataset size and removes irrelevant data, focusing on what’s important for your analysis.

5. Handle Missing Values

Data often has missing values, which can create issues in analysis. You can either remove rows with missing data or fill in values where appropriate.Use Power Query to Clean Data in Power BI. Join Hands on Training at Intellisoft Singapore

  • How to do it: Right-click the column and select Replace Values to fill missing data, or use Remove Rows > Remove Blank Rows to eliminate incomplete records.
  • Purpose: This ensures your dataset is complete or that missing data is handled in a way that doesn’t negatively impact your analysis.

6. Change Data Types

Correctly assigning data types (e.g., text, number, date) is crucial to ensure that Power BI interprets your data correctly.

  • How to do it: Select the column, then go to the ribbon, click on the Data Type dropdown, and choose the appropriate type (e.g., Decimal Number, Date, Text).
  • Purpose: This avoids issues like date misinterpretation or incorrect calculations due to mismatched data types, ensuring smooth analysis.

7. Remove Duplicates

Duplicated data entries can skew your analysis by inflating totals or introducing inaccuracies. It’s important to identify and remove any duplicates.

  • How to do it: Right-click the column where duplicates might exist, then select Remove Duplicates.
  • Purpose: Removing duplicates ensures that each data entry is unique, resulting in accurate and reliable reports.

8. Trim and Clean Data

Text data often comes with leading or trailing spaces or non-printable characters. Cleaning this data ensures consistency.

  • How to do it: Use Transform > Format > Trim to remove unnecessary spaces, and Clean to remove non-printable characters.
  • Purpose: Trimming and cleaning text data ensures consistency and prevents potential errors when joining datasets or conducting analyses based on string matching.

9. Split and Merge Columns

Sometimes, data is combined into one column and needs to be split (e.g., first and last names, date and time). Conversely, you may want to merge multiple columns into one (e.g., creating a full address from separate fields).

  • How to do it:
    • For splitting: Select the column, go to Transform > Split Column by delimiter (e.g., space, comma).
    • For merging: Select multiple columns, right-click, and choose Merge Columns.
  • Purpose: Splitting and merging columns helps you organize your dataset in a way that aligns with your analytical goals.

10. Apply and Load Data to Power BI

After completing the data cleaning, the final step is to apply your transformations and load the data back into Power BI.

  • How to do it: Click Home > Close & Load. This will apply all transformations and load the clean data into Power BI for analysis.
  • Purpose: This finalizes the cleaning process and makes your data ready for visualization, reporting, or further analysis in Power BI.

Conclusion

Cleaning data with Power Query is a vital part of any data analysis process in Power BI. These 10 steps will help ensure that your data is clean, reliable, and ready for actionable insights. By following this structured approach, you’ll minimize errors, streamline analysis, and set the foundation for building accurate and meaningful reports.

 

Power BI Tip #2: Reference Query Results in Another Query With Power Query [Video Tutorial]

Learn PowerQuery Reference at Intellisoft Singapore

Been analyzing the same or similar data for a long time?

I bet you spend a lot of time cleaning the data, and doing the same steps again and again… removing Blank, getting rid of duplicates, adding that Tax column, or fixing the same old formatting issues with the dates, numbers as text etc.

It does not have to be like that. Not anymore! You can take you cleaned data in Power BI, and use it in another dashboard or query. And you can analyze the same data in different ways too.

You see, for most types of analysis in the workplace, the base data is usually the same, probably coming from the same source. But the transformations will most likely be different, and the usage will be different too.

For example, Sales data from the past month could be used for many different analysis.

Some common types of analysis could be:

  1. to analyze the sales of the month and identify which products sold or did not sell well OR
  2. to forecast for future month based on past trends
  3. to understand inventory movement, analyze fast-moving and slow-moving goods by segmentation
  4. to recognize revenue
  5. to look at accounts receivable
  6. to analyze performance by salespersons, by geography, by division, by category, by department, and by customer segments

Now in both cases, the way we look at the data will be different, and the analysis will branch out differently too. And for each branch, we will have to load the same basic data, and do the same basic cleanup – remove duplicates, fill nulls, change data types, fix dates etc.

Rather than doing the same cleanup transformations again for each analysis, it is better to do the cleanup only once and save that query. Once the base query is ready, it can be used to extend for further transformation and analysis, depending on the need.

Power Query, which is available to you through Excel or Power BI can be used easily for this (Video Tutorial Below).  The thing to look for is

How to Reference a Query and Create a New Query from it

Referencing a Query allows us to simply take the result of one query, and take it further in another query.

I created a detailed, step by step video for you to see how to reference a query in Power Query. You can use it in Excel or in PowerBI. It works exactly the same way in both of these software.

I do hope you like it. You can subscribe to our YouTube Channel to be notified of new videos automatically.

Hope you do like our Excel & Power BI trainings, videos, and Online Blogs on Intellisoft website.

Learn Power BI From Practicing Professionals in Singapore
Intellisoft Systems conducts PowerBI training in Singapore each month, which are WSQ Funded for up to 70%, and there are several other grants to tap on too.

Do attend our hands-on practical training to learn Power BI from the beginning, and be able to analyze and visualize data easily with Microsoft tools.

Visit PowerBI Training in Singapore or email to training@intellisoft.com.sg for a course brochure.

This article and Video is written, edited & presented by: Vinai Prakash,
Founder & Master Trainer, Intellisoft Systems

Vinai conducts the Microsoft Power BI training in Singapore. His Power BI MasterClass courses are extremely popular, fun and easy to learn for beginners and experienced professionals alike.

Join Vinai in his next Power BI training course at Intellisoft. You won’t believe the insider secrets, shortcuts, and nifty ways that Power BI can be used, that Vinai will share in the workshop.

 

From Data Frustration to Data Transformation: A Success Story

Learn to convert data into information into knowledge into wisdom at Intellisoft Systems Singapore

The Challenge of Having Too Much Data & Too Little Time

In today’s data-driven business landscape, the ability to extract meaningful insights from vast amounts of information is crucial. The amount of data that is coming is too fast, and there is hardly any time to analyze it.Learn to convert data into information into knowledge into wisdom at Intellisoft Systems Singapore

This challenge is faced by too many people… But there is light at the end of this black hole of data… See how our heroine, Amanda Lee managed to solve this challenge.

We take you on a captivating journey with Amanda, an employee who faced a daunting challenge: analyzing complex data from SAP.

Her determination, resourcefulness, and expertise in SQL, Excel, and Power BI led her to become a valued data analyst within her organization.

Let’s delve into the Case Study of Amanda and explore the transformative power of these tools, and how Amanda managed to survive the day and thrive…

The SAP Data Conundrum:

Amanda, a dedicated employee known for her analytical skills, was tasked by her manager to analyze data from SAP, the company’s backbone for managing vital business information.

The data was available in multiple places in some standard reports, and some custom reports.Data in multiple silos can be combined with Power BI, SQL, Python. Learn how to do this at Intellisoft Courses in Singapore.

But the manager wanted a perfect report, and it was difficult to make sense of the whole, big picture from multiple sections.

So Amanda was tasked to take this challenge and make it work.

The challenge lay in finding a single report that provided a comprehensive overview of the required data. Undeterred, Amanda set out to conquer this data conundrum.

Exploring Standard Reports:

Amanda embarked on a meticulous exploration of SAP’s standard reports, hoping to find the perfect report or a solution.

She dedicated countless hours to examining various reports, seeking the elusive comprehensive data set.

However, despite her best efforts, none of the reports met the boss’s requirements.

Exporting and Excel Limitations:

Not one to give up easily, Amanda decided to export the data from SAP Reports into Excel, believing it would allow her to manage and analyze the information more effectively.

To her dismay, the exported data turned out to be massive, exceeding the limits of Excel’s capabilities. It became evident that relying solely on Excel would not suffice to solve this complex data puzzle.

Plus, loading multiple huge report files, and other Master data files at the same time caused her computer to crash often.

Excel and the Power of VLOOKUP:

Determined to find a solution, Amanda delved deeper into Excel’s functionalities and discovered the power of VLOOKUP.

She realized that by merging data from multiple sources, she could create a more comprehensive dataset. This process, however, proved to be laborious and error-prone, requiring significant time and effort to align the data properly.

Excel VLookup Sample
Excel VLookup Sample

Learning VLOOKUP is one thing, and applying it to lookup multiple codes & descriptions from multiple sheets and multiple Excel files was too cumbersome and slow.

Discovering SQL:

Driven by her desire for efficiency, Amanda set out on a quest to find a more robust solution. She began exploring the world of databases and stumbled upon SQL (Structured Query Language).

Recognizing its potential in handling large datasets and performing complex queries, Amanda dedicated to mastering SQL language.

Learn SQL to query any database quickly in Singapore
Introduction to SQL training in Singapore. Learn to query any database with SQL quickly in 2 days at Intellisoft

Learning SQL helped in picking the right data directly from transactional tables in SAP’s Oracle Database by joining several table and writing efficient SQL queries.

The SQL Solution:

Armed with SQL knowledge, Amanda devised a strategy to extract the required data needed from the corporate SAP database.

With a single SQL query, the query effortlessly pulled out the required information, bypassing the arduous process of manual data manipulation.

Amanda’s achievement in harnessing the power of SQL marked a significant turning point in her quest for analytical excellence.

Excel Dashboards and Visualizations:

With the right data finally at her disposal, Amanda exported it back into Excel, now equipped with the necessary insights.

She utilized Excel Dashboards to create various analyses and visualizations, bringing the data to life in a meaningful and impactful way.

The management was astounded by the depth of insights provided by these visualizations, realizing the untapped potential of data analysis.

Introducing Power BI:

The success achieved with Excel Dashboards paved the way for an even more remarkable transformation. Amanda was introduced to Power BI, a powerful business intelligence tool, by the Corporate HQ of the company.

She was spellbound by the dynamic, beautiful, amazing analysis capabilities of Power BI.

She began to migrate the entire solution from Excel to Power BI, creating interactive dashboards and reports that enabled the entire organization to access and explore the latest data analysis  effortlessly, from any device, without waiting for manual data refreshes and month end jobs to complete running.

Becoming the Data Analysis Expert:

Amanda’s expertise in SQL, Excel, and Power BI elevated her to a coveted position within the company.

She became the go-to analyst for senior management, constantly engaging in discussions and providing innovative solutions to analyze and visualize information for the leadership team.

Her journey from an individual contributor to a key player in shaping data-driven decisions exemplified the transformative power of mastering these tools.

Conclusion:

The story of Amanda’s journey from grappling with SAP’s data challenges to becoming an indispensable data analysis expert is a testament to the incredible possibilities offered by SQL, Excel, and Power BI.

By harnessing the power of these tools, individuals can unlock the true potential of data, transform their organizations, and become drivers of analytical excellence in the ever-evolving business landscape.

What Challenge Are You Facing?

Are you facing similar challenges? Or do you have other data challenges?

Do let us know. Our experienced training coordinators can assist you in understanding your data challenges and then guide you with an appropriate course to choose from.

This can help you get started in the right way, and not face the challenges that Amanda faced.

Cheers,

Vinai Prakash, Founder & Principal TrainerIntellisoft Systems

Recommended Reading:

What is Power BI: A Must-Have Skill For Analysts & Decision Makers

How to Use Power BI at Intellisoft Singapore classroom Training

What is Power BI: Intro to the Most Powerful Visualization Tool from Microsoft

The world runs with Technology but ruled by Data. Learning to process, manage, analyze and present data can lead to a flourishing Career Path.

Becoming a Data Analyst is the new cool. Data analysis as a career path has a bright future and a variety of options become available to keep moving ahead in your career.

The Data Analyst career path starts from grabbing the right Skills. While it needs a basic knowledge of SQL for querying Data and Python fundamentals, it a very much mandatory to upgrade yourself with the Key Skills like Advanced Microsoft Excel and Power BI.

We all have heard of SQL, Python and Microsoft Excel, but you may not be familiar with Microsoft Power BI.

Let’s find out What Power BI is, and How you can benefit from learning & using Power BI.

Why Microsoft PowerBI is Essential For Data Analysis?

Power BI is an intelligent software that is highly equipped to Analyze data and gain Insights quickly, without any fuss.

You can visualize data and create personalized reports & dashboards with KPIs that matter in your Business.

It is very popular among Data analysts because of the Speed, Accuracy, Consistency, and Security. You can set the report to refresh automatically, and inform the key stakeholders to view it on their i-Pads and Mobile phones.

The reports and insights can be collaborated effectively across all the different Software’s like Excel, SalesForce, SharePoint, SAP, Oracle Database, and even Microsoft Teams. This allows the whole team to get involved in Data Driven decision making.

Extensive Connections & Flexibility in Power BI

Microsoft Power BI has a growing Library of 100+ connectors that comes for Free and connects it to various Cloud based platforms like SQL, Salesforce and SharePoint.

In Power BI Desktop, users can:

What Power BI Can Do: Benefits of Microsoft Power BI
What Power BI Can Do: Benefits of Microsoft Power BI
  • Connect to data
  • Transform and model the data
  • Create charts and graphs
  • Create reports and dashboards that are collections of visuals
  • Share reports with others using the Power BI service

What’s covered in Power BI Training?

This PowerBI MasterClass teaches the skills a business analyst needs to know in order to successfully use Power BI, Write DAX Measures and Use Power Query to Clean and Load data.

The course starts out first by highlighting the key Advanced Excel functionality useful for data analysis, and then moves to Power BI tools. We cover Microsoft Power Query, Power Pivot & Power BI – all built into the new Power BI Desktop Application.

This Practical, Hands-on workshop covers:

  1. Importing and creating relationships between tables of data.
  2. Understanding the optimal data structure to use in PowerBI.
  3. Writing basic Data Analysis eXpressions (DAX) formulas to extract business insights.
  4. Then writing more advanced DAX formulas that use the power of DAX to extract additional business insights from the data that are not immediately obvious (yet are inherently available).
  5. An introduction and overview of Power Query, how to use the tool to build data extraction and cleaning scripts, and why it is so great.
  6. Helping Excel professionals move from being a normal user in Excel to being a Power BI analyst, covering the differences between the tools and how to start using Power BI Dashboards effectively.

You Can Learn Power BI in a Classroom Setting

Unlike the other Basic computing software’s, Power BI should be learnt and mastered through a proper Training or a Master Class to make you understand the Power BI suite of products available from Microsoft, and be a Power Ninja in analyzing, visualizing & understanding Business Intelligence Reporting.

You should attend a Focused, instructor-led power packed program that make you

Focused Instructor Led Power BI Course in Singapore
Focused Instructor Led Power BI Course in Singapore
  1. Understand Power Query & DAX, and how to apply it to your job.
  2. Achieve better and faster results than with existing Microsoft tools.
  3. Produce valuable KPI metrics for your business that never existed before.
  4. Learn best tips & tricks to solve complex problems & create stunning work.

Where can I Attend Power BI Course in Singapore?

Intellisoft Systems offers you an intensive Power BI Training in Singapore for 2 days.

Our expert approach in this classroom training course makes it accessible to become an Excel Pro.

At the end of the 2 days, you will be well on you way to becoming a Power BI, Power Pivot and Power Query Ninja!

What are the Pre-Requisites to Learning Power Query, Power Pivot & Power BI

You can easily learn Power BI f you have Basic knowledge of Excel, and can write simple formulas like SUM, IF, Nested IF, and:

Note: Anyone with a Database, BI, Programming, or similar experience are quite qualified to take this course, even if lacking in Excel experience.

Thousands of people like you have attended our training & started analyzing data, in Sales, Customer Service, Finance, Logistics, HR, Business & other functions in no time.

Gain Valuable Insights by Visualizing Data Quickly!

Whether you work in Banking, Marine & Offshore, Telecom, Networking, IT, Manufacturing, Services, Government or Healthcare, you must tap on the Best and Most Useful software for Data Analysis & Business Intelligence – POWER BI.

Go Beyond Excel Pivot Tables, Learn Power BI now!

Where: Intellisoft Systems, Singapore

You can Register Online or contact us to block seats for you while you get internal approvals.

Companies Can Claim SDF Funding for sponsoring their SG/PR staff. Individual Singaporean can use their SkillsFuture Funds to offset the course fees.

Why wait? Join Intellisoft now! Please call or Email me to reserve your spot on this Power Pivot and Power BI for Excel Training Program.

Like us on Facebook, Follow us on Instagram and Do Check out our LinkedIn for more updates on the Courses & Grants!

P.S: Looking for cool Careers? Check out the Top 5 Cool Careers in the Job market!

Article Written by Vinai Prakash, MBA, PMP, GAP, ACTA Certified

Additional Resources for Power BI

Training Courses

Data Analytics & Visualization with Power BI

Learn Microsoft Power BI Suite For Better Data Analysis & Reporting

Power BI Tips, Tricks & Video Tutorials

Power BI Tip #2: Reference Query Results in Another Query With Power Query [Video Tutorial]

Microsoft Power BI: Super Charge Your Data Analysis Process

Power BI Tip #6: Fixing The Vertical Axis in Power BI Visualisations

Power BI Tip #5: All About Slicer Controls in Power BI

Power BI Tip#4: Enter Data Into Power BI Quickly [Video]

Power BI Tip #3: Quick Formatting of Power BI Visuals

Free Tips, Tutorials & Training Grants Info

Learn from expert tips, tricks and resources for Excel, PowerPoint, Photoshop, Python, Power BI, Project Management, IT, Soft Skills & more with our Email Newsletter.
Plus get the latest news on Grants. Join Today!

Found What You Were
Looking For?

Just Tell us...

We're Here To Help You!