In this Power Bi tutorial, We will discuss how to convert Date to Text in Power BI. In addition, we will also discuss how to convert Date to Text using Power BI DAX in Power BI.
Moreover, we will also cover the below-mentioned headings:
- Power BI convert date to text YYYYMMDD
- Power Query date.totext example
- Power BI change date to month and year
- Power Query converts date to text
Also, Read: Power BI Conditional Formatting Positive and Negative Numbers
Power BI converts date to text
Here we will see how to convert the date data type to text data type in Power Bi,
Yes, it is possible to convert the date data type to a text data type in Power BI using DAX expression.
We will use the financials data table in this example, to convert the Date column which is of date data type to the text data type in Power Bi.
Steps to follow to convert the date data type to a text data type in Power BI
Load the financials data table into the Power Bi desktop using the get data option. Once the data has been loaded, check the Date column data type by selecting the Date column header, Column tools – > data type as highlighted below:
- To convert the date data type to the text data type, simply expand the data type dropdown option and choose the text data type.
- It will automatically converts the date column from the date data type to the text data type as highlighted below:
This is how to convert the date data type to text data type in Power Bi.
Check out: Power BI Group by Column [With Various Examples]
Power BI convert date to text DAX
Let us see how we can convert the date to text DAX in Power BI
In this example, we will convert the date data type to text data type using DAX in Power BI.
Open the Power Bi desktop and load data into it using the get data option, select the new column under tables tools, and apply the below formula to convert a date data type to a text data type.
Date to Text = CONVERT(financials[Date],STRING)
Where,
- Date to Text = New column name
- CONVERT = Function Name
- financials = Table Name
- Date = Existing Column name with date data type
- Once the DAX formula has been entered, select the check icon.
- In the below screenshot, you can see that the new column displays the expected value with the text data type as highlighted:
This is how to convert the date to text DAX in Power BI.
Power BI converts date to text YYYYMMDD
Here we will see how we can convert the date to text YYYY MM DD in Power BI.
In this example, we will use the Power BI Date Format to convert the date data type to the text data type in Power BI.
Load data source into the Power BI desktop. Once the data has been loaded select Table Tools -> New column as shown below:
In the calculate column formula bar, apply the below-highlighted formula to convert the date data type to text data type YYYY MM DD.
YYYY MM DD Format = format([Date], "YYYY MM DD" )
Where,
- YYYY MM DD Format = New column name
- format= Function Name
- Date = Existing Column name with date data type
- Once the DAX formula has been entered, select the check icon.
- The screenshot below displays the expected value with the text data type in the mentioned (YYYY MM DD format) as highlighted in the newly added calculated column.
This is how to convert the date to text YYYY MM DD in Power BI.
Read: Power BI DAX ISBLANK vs ISEMPTY
Power BI changes the date to month and year
Let us see how to convert the date to text month and year in Power BI.
In this example, we will use the Power BI Date Format to convert the date data type to the text data type of month and year in Power BI.
In the Power BI desktop, load the source data using the get data option. select the new column under tables tools, and apply the below formula to convert a date data type to a text month and year.
MonthYear = FORMAT([Date]," MM YYYY")
Where,
- MonthYear = New column name
- format= Function Name
- Date = Existing Column name with date data type
- Once the DAX formula has been entered, select the check icon.
- The newly added calculated column displays the expected value with the text data type in the mentioned month and year format(MM YYYY) as highlighted below:
This is how to convert the date to text month and year in Power BI.
Power Query date.totext example
Let us see how we can convert the date data type to a text data type using the Power query editor in Power Bi.
In this example, we will use the Date column value which is of date data type, we will convert it to the text or string data type in Power BI.
Follow the below steps to achieve it:
Load the data source into the Power Bi desktop. Under the Home tab select the transform data option as highlighted below, it will automatically redirect to the Power Query editor.
Select Add column -> Custom column option, enter the below-highlighted formula, and click the ok button.
=Date.ToText([Date],"MM/yyyy")
- In the below screenshot, you can see that the custom column has been converted from the date 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.
= Table.AddColumn(#"Changed Type", "Custom", each Date.ToText([Date],"MM/yyyy"))
This is how to convert the date data type to a text data type using the Power query editor in Power Bi.
Have a look: Power BI Bar Chart Conditional Formatting Multiple Values
Power Query converts a date to text
Here we will discuss how we can convert the date 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 date type to text type using the power query editor. In the following, I have described the two different ways to achieve it.
Approach 1:
- Load the data source into the Power Bi desktop, and to check the date column data type, select the sales column header -> Column tools – > data type.
- select the transform data option under the Home tab as highlighted below, and it will automatically redirect to the Power Query editor.
- In the Power query editor, select the date 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 date data type for the selected date column.
= Table.TransformColumnTypes(#"Removed Columns",{{"Date", type text}})
- In the below screenshot, you can see that the date column has been converted from the date 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.
This is one approach to converting the decimal to a text data type using the Power Query editor in Power Bi.
Approach 2:
- Now let us discuss the second approach, In the same way, load the data source into the Power Bi desktop, and to check the date column data type, select the date column header -> Column tools – > data type.
- 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 Date 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 to the text data type from the date data type for the selected date column.
= Table.TransformColumnTypes(#"Removed Columns",{{"Date", type text}})
- In the below screenshot, you can see that the date column has been converted from the date 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 date to text using the Power Query editor in Power Bi.
These are the two different approaches that to convert the date data type to text data type using the Power query editor in Power Bi.
In this Power Bi tutorial, We have discussed how to convert Date to Text in Power BI. In addition, we also discussed how to convert Date to Text using Power BI DAX Power BI.
Moreover, we also covered the below-mentioned headings:
- Power BI convert date to text YYYYMMDD
- Power Query date.totext example
- Power BI change date to month and year
- Power Query converts date to text
Additionally, you may like some more Power BI tutorials:
- How to Convert Decimal to Text in Power BI
- How to Convert Text to Number in Power BI
- How to Convert Number to Text in Power BI
- Power BI convert hours to minutes
- Power BI convert yyyymmdd to date
- Power BI Conditional Formatting Based On Field Value
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