0% found this document useful (0 votes)
5 views

Evaluating and changing column data types

This document explains the significance of data types in Microsoft Power BI, highlighting their role in organizing datasets for analysis. It covers how Power BI infers data types from various sources and the importance of verifying and updating these types to avoid errors in data processing. Additionally, it provides a step-by-step guide on how to change data types in Power BI to ensure accurate data analysis.

Uploaded by

Aya Laadaili
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Evaluating and changing column data types

This document explains the significance of data types in Microsoft Power BI, highlighting their role in organizing datasets for analysis. It covers how Power BI infers data types from various sources and the importance of verifying and updating these types to avoid errors in data processing. Additionally, it provides a step-by-step guide on how to change data types in Power BI to ensure accurate data analysis.

Uploaded by

Aya Laadaili
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Evaluating and changing column data types

Introduction
At this point of the course, you should know that data types in Microsoft Power BI are used to
classify values to ensure a better-organized and structured dataset. You should also know
that there are three main data groups: structured, semi-structured, and unstructured.

Conventional databases, such as ERP or Enterprise resource planning databases, are


classified as structured data since they store data in regular and rule-based systems.
However, data such as sensor data, tweets, and configuration files like JSON (JavaScript
Object Notation) or XML (Extensible Markup Language), which are not within a complete set
of database rules, are classified as semi-structured data. The type of structure in your source
data often determines the data types you must work with.

In this reading, you'll learn how data types influence how you evaluate datasets. You'll also
explore how to change data types where required.

The importance of data types


The importance of data types in data sources is significant. Data types are a characteristic
that determines the type of data in a dataset. They are crucial for data analysis and
processing.

For example, let's consider a dataset used to analyze an online store's sales. This dataset may
contain information such as:

product name
sales date
sales amount
customer name
and customer address.
Online store dataset information Data type

Sales date Date

Product name Text

Customer name Text

Customer address Text

Sales amount Numeric

Each of these columns has a different data type as follows:

Sales date has a date data type


the sales amount has a numerical data type
the product name has a text data type
and the customer name and address datasets also have a text data type.

Identifying these data types is essential for data analysis and processing. For example,
knowing that a sales amount has a numerical data type is necessary to perform a SUM
operation. Likewise, it's important to know that the data has a text data type to analyze
customer addresses.

As another example, let's consider a hospital's patient data. This data may include
information such as name, age, gender, diagnosis, and medication use.

Hospital dataset information Data type

Name Text

Age Numerical

Gender Text

Diagnosis Text

Medication text
Each of these columns has a different data type. The Age column is a numerical data type,
while the diagnosis and medication columns use a text data type. Identifying these data types
is crucial for analyzing a patient's health condition and creating a suitable treatment plan.

For example, knowing that the age column has a numerical data type is necessary for using it
in mathematical formulas to create a treatment plan based on a patient’s age. So, correctly
identifying data types in data sources and using appropriate methods for data analysis is
essential.

How Power BI infers data types


Microsoft Power BI can connect to many different types of data sources and provide
integrated data analysis and visualization using the data imported from these sources. When
Power BI Desktop connects to any data source and begins to import data from a table, it
examines the data in the first 1000 rows for each column. It then determines an appropriate
data type for that column by default.

If the connected data source is a standard database system or a spreadsheet with strict rules,
there is little chance of errors or inconsistencies in the type of data being read. However,
errors can sometimes occur in data sources where data is manually entered, such as classic
CSV (Comma Separated Value) or Excel files.

However, these types of data sources don’t impose type restrictions on a column basis as
strictly as a database does. So, any inconsistent data that may appear in these columns can
lead to errors or inconsistencies in detecting the column type.

Updating data types


If the data type is not correctly detected, some complications may occur. Usually, these
types of situations occur in numerical or date fields, and the data type is incorrectly marked
as text. Therefore, performance issues may arise when attempting to convert the data type.
Incorrect data types may prevent you from creating certain calculations, hierarchies, or
relationships.

So it's important that you check the column types in Power Query Editor before loading the
data into the reporting environment. If you detect an incorrect data type, you can correct it
by changing it to the correct type. Additionally, you can also update the format of the data.

Change a data type

1. On the left side of the column header, select the data type icon and then select the correct
data type from the

drop-down list.
2. Alternatively, in the Transform tab, select Data Type and then select the correct data type
from the list.

3. When you save this change, this step is called Changed Type and is reiterated every time
the data is refreshed.

You then need to apply your changes to your data model.

4. In the Home tab, select the Close & Apply menu. Then, choose the Apply option to apply
the changes and keep the

window open.

5. Or choose Close & Apply to apply the changes and close the Power Query Editor.

Conclusion
Power BI can connect to many different types of data sources. In such sources, data is
classified into three main groups called structured, semi-structured, and unstructured data.
When you connect to a data source, Power BI imports the contents and tries to detect the
data type for each piece of data.

In this reading, you learned about the importance of the data type, and you explored how to
check if the data type has been detected correctly before using it. If you detect an incorrect
data type, you should now know how to correct it by changing its type.

You can also refer to the following Microsoft Learn article for details about evaluating and
changing column data types in Power BI.

You might also like