DEV Community

Cover image for How analysts translate messy data, and Dashboards into actions in Power BI
Grace Valerie
Grace Valerie

Posted on

How analysts translate messy data, and Dashboards into actions in Power BI

The main goal for data analysts is to make sense of data and express findings to respective stakeholders. The analyst imports into Power BI from different sources, upon examining it is not prepared for analysis.
Simple mistakes such as columns with string data types containing numeric rows, columns containing errors and null values, duplicated unique identifiers can make the data unusable.

Data Cleaning and Preparation

Power BI offers Power Query which is powerful for preparing and cleaning data. Clean data is beneficial for:

  • Producing more accurate results when performing calculations
  • Finding data more intuitively due to better organization
  • Simpler navigation and effective use of slicers.

Steps for cleaning data

  1. First step is transforming your imported data to ensure it is suitable for use. Open Power Query editor by clicking on transform data in the queries section of the menu.

transform data icon
Power Query will only modify a view of your data and not your original data.

  1. Next is to identify column headers and names. In the case of the example below, column names are non-descriptive making it hard to understand what each column represents.

non descriptive column names

When you go to transform data, the correct column names are displayed as the first row. Select the table home icon as shown and on the dropdown, click on Use first Rows as header.
table home icon
Its also possible to change the header from the menu.
Transform section on the menu
Now the correct headers will be displayed

correct headers

Verify that the column names are correct by removing spelling errors, and ensuring the naming convention is user friendly. In this case column names are capitalized, if using snake case or any other convention, ensure all columns are consistent.
To rename a column, right click the column name and select rename. In this case we can rename the Location column to Order Location.

location change
order location

You can also remove any column you find unnecessary by going to

remove columns menu

Every time you make a change when transforming data, it will be displayed on the properties tab.

applied steps tab
You can easily undo a change by clicking on the X.

Duplicates

Remove duplicates from columns to only keep unique names for selected columns. We have identified that each transaction should be unique and no two transactions can share a transaction id. In this example, we remove duplicate transactions by right clicking transaction id and selecting remove duplicates.

Incorrect data types

When importing data, some column data types are incorrectly interpreted such as numeric data saved as text. In this case, data formatted on the left implies it is text while numeric data will be formatted on the right.

incorrect data types

When you click a specific column name the data type will also be displayed in the menu as follows

text data type
Click on the dropdown to select the appropriate data type.
Incorrect data types can prevent you from creating hierarchies, performing calculations, or forming proper relationships with other entities.

In this example we transformed the following columns data types into whole numbers, decimal and date types

transform data types

Replacing nulls, Errors and blanks

These types prevent you from performing calculations and summarization on data.

replace values bi
Power query uses find and replace to find the values in a row you want to replace and change to the specified value.

find and replace
Replace errors and blanks with unknown.

Use column distribution in the view tab to detect anomalies in your data.

detect anomaly
Once you are done with cleaning and preparing your data in power query, you can click on close and apply.

Data Analysis Expressions

These are functions and operators that can be combined to build formulas in Power BI

Common DAX Functions
Aggregation Functions

SUM - adds all the numeric values in a given column and returns a decimal number.

= SUM(column)
Enter fullscreen mode Exit fullscreen mode

We can find the total revenue by summing all orders

revenue
revenue measure
AVERAGE - Returns the average mean of all numeric values in a column. Null values may cause the average to result in an error.

AVERAGE(column)
Enter fullscreen mode Exit fullscreen mode

In an example you can calculate the average of customers loyalty score as shown

average loyalty score
The above is achieved by creating a new measure which is a dynamic calculation on data that is created using DAX.
We can view the result of the measure using a card in report view.

loyalty score card
COUNT - Used to count the number of rows in the specified column which and NON-BLANK

total products
COUNTROWS - This is used when you want to count the number of rows in the specified table defined by an expression

Total Electronic Products =
CALCULATE(
    COUNTROWS(Products),
    Products[Category] = "Electronics"
)
Enter fullscreen mode Exit fullscreen mode

The above COUNTROWS example returns the count of only products in the electronics category

count rows
SUMX - evaluates the expression for each row in a table then returns the sum. It is referred to as an iterator function and only counts numeric rows.

SUMX(
    Table,
    Expression
)
Enter fullscreen mode Exit fullscreen mode
Filter Functions

Powerful functions that let you manipulate data context
CALCULATE - used to evaluate an expression
FILTER - returns a subset of a different table as a new table
INDEX -
RANGE
RANK

Date and Time Functions

CALENDAR - returns a new table with a single column of a set of dates.

= CALENDAR (DATE (2024, 7, 1), DATE (2026, 7, 31)
Enter fullscreen mode Exit fullscreen mode

calendar dates
DATE - returns the date in datetime format.

DATE(yyyy, mmm, dd)
Enter fullscreen mode Exit fullscreen mode

DATEVALUE - converts text value to date in datetime format.

Dashboards in Power BI

Dashboards are used in power bi to tell a story about the data through visualizations. It highlights the important details that can be reviewed in the report
Here is a simple example of a dashboard

dashboard visual

Conclusion

To get the most out of data we need to transform it, perform calculations and create intuitive dashboards that summarize all the insights from the data. Power BI is a powerful tool to achieving this. Understanding and following the right steps will help data analysts to analyze data efficiently.

Top comments (0)