Generally, when you load a table from any data source, Power BI will automatically detects the data type of a column. However, there may be some situations where Power BI might get them wrong. For example, it may consider amounts, values, or even dates as the text. In these situations, you can use Power BI change data types of a column option. In this article will show you, How to Change Data Types of a Column in Power BI with example.
How to Change Data Types of a Column in Power BI
To demonstrate this Change Data Types of a Column, we are going to use the excel table that we imported in Enter Data article.
In order to change data types of any column, please click Edit Queries option under the Home tab.
Clicking Edit Queries option will open a new window called Power Query Editor.
From the below screenshot you can see, Yearly Income, Sales and HireDate columns are loaded as the text
There are couple of ways to change data types of a columns in power bi.
First Approach to Change Data Types of a Column in Power BI
Please select the Column for which you want to change the data type. Next, click on the left corner of the column header (currently it represent ABC text)
Clicking in that position will open a drop down list of supporting data types. Please select the data type that suits your data. Here, we are selecting the Whole number
Changing data type of a column will open the following pop up window. Click on the Replace Current button
Now you can see the Yearly Income header is displaying 123 (whole number) not ABC (text)
Second Approach to Change Data Types of a Column in Power BI
Please select the Column name that you want to alter the data type, and click on the Data Type button under the Home tab
This will show you the drop down list of available data types. For the demo purpose we are selecting Fixed Decimal Number
This time we will select the Add New Step. It means, this change column type will add as a new step under the Applied Steps.
As you can see from the below screenshot, it changed the data type of Sales column and added a new step under the Applied Step.
Third Approach to Change Data Types of a Column in Power BI
Please select the Column that you want to change the data type and right-click on it will open the context menu. Select the Change Type and then the data type from the list. For now, we are selecting the Whole Number.
Don’t forget to hit Close & Apply option under the Home tab to apply these changes.