How to Convert Date to Text in Power BI

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:

Power BI converts date to text
Power BI converts date to text
  • To convert the date data type to the text data type, simply expand the data type dropdown option and choose the text data type.
Power BI converts date to text example
Power BI converts date to text example
  • It will automatically converts the date column from the date data type to the text data type as highlighted below:
Example of Power BI converts date to text
Example of Power BI converts a date to text

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,

  1. Date to Text = New column name
  2. CONVERT = Function Name
  3. financials = Table Name
  4. 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:
Power BI convert date to text DAX
Power BI convert date to text DAX

This is how to convert the date to text DAX in Power BI.

See also  Power BI Conditional Formatting Based on Text

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:

Power BI converts date to text YYYYMMDD
Power BI converts date to text YYYYMMDD

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,

  1. YYYY MM DD Format = New column name
  2. format= Function Name
  3. 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.
Power BI converts date to text YYYYMMDD example
Power BI converts a date to text YYYYMMDD example

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,

  1. MonthYear = New column name
  2. format= Function Name
  3. 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:
Power BI changes the date to month and year
Power BI changes the date to month and year

This is how to convert the date to text month and year in Power BI.

See also  Power BI Measure If Multiple Conditions

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.

Power Query date to text example
Power Query date to text example

Select Add column -> Custom column option, enter the below-highlighted formula, and click the ok button.

=Date.ToText([Date],"MM/yyyy")
Power Query date to text
Power Query date to text
  • 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"))
Example of Power Query date to text
Example of Power Query date to text

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:
Power Query converts a date to text
Power Query converts a date to text

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.
Power Query converts a date to text example
Power Query converts a date to a text example

This is one approach to converting the decimal to a text data type using the Power Query editor in Power Bi.

See also  Power BI Month over Month Change [With Examples]

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:
Example of Power Query converts a date to text
Example of Power Query converts a date to text

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.
Power Query converts a date to text example
Power Query converts a date to text example

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:

>