In this Power Bi tutorial, We will discuss how to convert Decimal to Text in Power BI. In addition, we will also discuss how to convert Decimal to Text using the Power Query editor in Power BI.
Convert Decimal to Text in Power BI
Here we will see how to convert the Decimal data type to text data type in Power Bi,
Yes, it is possible to convert the Decimal data type to a text data type in Power BI.
We will use the financials data table in this example, to convert the Units Sold column which is of decimal data type to the text data type in Power Bi.
To achieve this, follow the below-mentioned steps:
- Load the financials data table into the Power Bi desktop using the get data option. Once the data has been loaded, check the Units Sold column data type by selecting the Units Sold column header, Column tools – > data type as highlighted below:
Now click on the column tools -> new column option as shown below:
- And use the below-mentioned formula in the formula bar to convert the decimal to text data type and click on the check icon.
Decimal to Text value = FORMAT(financials[Units Sold],"#")
Where,
- Decimal to Text value = New calculated column
- FORMAT = Function Name
- financials = Table Name
- Units Sold = Existing Column Name
- In the below screenshot, we can see that the newly created calculated column displays the Text data type as highlighted below:
This is how to convert the Decimal data type to the text data type in Power Bi.
Also, Read: How to Convert Text to Number in Power BI
Power Query Convert Decimal to Text
Let us see how we can convert the decimal data type to a text data type using the Power query editor in Power Bi.
Yes, there are two different approaches that we can convert the decimal type to text type using the power query editor. In the following, I have explained the two different ways to achieve it.
Approach 1:
In this example, we use the financials table data, and we convert the sales column which consists of the decimal data type, we will convert it to the text data type.
Follow the below steps to achieve it:
Load the data source into the Power Bi desktop, and to check the sales column data type, select the sales column header -> Column tools – > data type as displayed below:
Under the Home tab select the transform data option as highlighted below, it will automatically redirect to the Power Query editor.
In the Power query editor, select the sales column, and under the Home tab, expand the Data type option and choose the data type as Text data type as shown below:
Once the data type has been selected as a text type, it will be automatically converted to the text data type from the decimal data type for the selected sales column.
= Table.TransformColumnTypes(#"Changed Type",{{" Sales", type text}})
- In the below screenshot, you can see that the sales column has been converted from the decimal data type to the text data type in the Power Query editor.
- Click on the Home-> Close and Apply option, so that the changes will be reflected on the Power Bi desktop.
- To check the sales column data type in Power BI, select the sales column header -> Column tools – > data type as displayed below:
- Here we can see the changes have been reflected, and for the sales column data type has been converted to a text data type.
This is one approach to converting the decimal to a text data type using the Power Query editor in Power Bi.
Check out: How to Convert Number to Text in Power BI [With Leading Zeros]
Approach 2:
Now let us discuss the second approach, and we will use the financials table data, and we convert the discounts column which consists of decimal data type to the text data type.
Open the Power Bi desktop and load data into it, and to check the discounts column data type, select the discounts column header -> Column tools – > data type as displayed below:
- select the Home -> transform data option and it will automatically redirect to the Power Query editor.
- In the Power query editor, select and Right click on the Discounts column -> Change Type -> Text option as illustrated below:
Once the data type has been changed to the text data type, it will be automatically converted from the decimal data type to the text data type for the selected discounts column.
= Table.TransformColumnTypes(#"Changed Type",{{" Sales", type text}, {"Discounts", type text}})
- In the below screenshot, you can see that the discounts column has been converted from the decimal data type to the text data type in the Power Query editor.
- Click on the Close and Apply option, so that the changes will be reflected on the Power Bi desktop.
This is another approach to converting the decimal to text using the Power Query editor in Power Bi.
These are the two different approaches that to convert the decimal data type to text data type using the Power query editor in Power Bi.
Moreover, you may like some more Power BI tutorials:
- Power BI DAX ISBLANK vs ISEMPTY
- Power BI Conditional Formatting Positive and Negative Numbers
- Power BI Group by Column [With Various Examples]
- Power BI Bar Chart Conditional Formatting Multiple Values
- Power BI Count If True
- How to Concatenate with Space in Power BI
- Power BI Conditional Formatting Based on Measure
In this Power Bi tutorial, We have discussed how to convert Decimal to Text in Power BI. In addition, we also covered how to convert Decimal to Text using the Power Query editor in Power BI.
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com