When data is loaded into Power BI model, most of the time Power BI automatically detect the data type of columns. Some times Power BI detect them wrong, for example it considers amount, values and dates as text.
You might have faced such situation then you can use Power BI change data types of a column option to change the data types.
Lets see how to change the data type of column in Power BI.
In Ribbon bar, select Transform data under Transform data tab.
It opens a Power Query Editor as shown below.
There any many ways that you can follow to change the data type of columns.
Let see them one by one.
Change the data type of a column by clicking on column
You can see below the data type of Units Sold column is Decimal Number (1.2).
Lets change the data type to Whole Number.
Just click on the left corner of the column header, It opens a drop-down list of available data types, now you have to select the data type that you want.
As we want to change the data type to Whole number so just select (123)Whole Number.
Once you select the data type, a pop-up window opens which ask you either you like to Replace the existing conversation, or preserve the existing conversion and Add new conversion as a separate step.
Lets click on the Replace current button as shown below.
Once you click on Replace current button, you can see, Data type of Units sold column is changed from Decimal number (1.2) to Whole number (123).
Change the column data type from ribbon bar
Lets change the data type of Gross Sales from Decimal number (1.2) to whole number (123).
Select the column that you want to change the data type as shown below.
Next, click on the Data type tab under the Home tab. It opens a drop-down of available data types.
Now we will select the data as whole number as shown below.
Next, select the Replace current.
You can see, Data type of column Gross Sales is changed to Whole number (123).
Change the data type of a column by right clicking on the column
Lets change the data type of column Sales from Decimal number to Fixed decimal number.
Just right click on column, you see a context menu then select Change type and click on Fixed decimal number as shown below.
Now, this time we will select Add new step.
Now you can see the data type of Sales column is showing as a $ Fixed decimal number.
Also, you will notice that this change column type add as a new step under the Applied Steps.
Also Read..