Power BI: How to Convert Date to Quarter and Year


You can use the following syntax in DAX to convert a date to a quarter and year format in Power BI:

qtr_year = "Q" & FORMAT('my_data'[Date], "Q") & " " & FORMAT('my_data'[Date], "YYYY") 

This particular example creates a new column named qtr_year that contains the quarter and year of the corresponding date in the Date column of the table named my_data.

The following example shows how to use this syntax in practice.

Example: Convert Date to Quarter and Year in Power BI

Suppose we have the following table in Power BI that contains information about total sales made on various dates by some company:

Suppose that we would like to display each of the dates in the Date column in a quarter and year format.

To do so, click the Table tools tab, then click the icon called New column:

Then type the following formula into the formula bar:

qtr_year = "Q" & FORMAT('my_data'[Date], "Q") & " " & FORMAT('my_data'[Date], "YYYY") 

This will create a new column named qtr_year that displays the corresponding dates in the Date column in a quarter and year format:

Power BI convert date to quarter and year

Note that the & symbols in the DAX formula allow us to concatenate text values.

If we’d like, we could also spell out the word “Quarter” by using the following formula instead:

qtr_year = "Quarter " & FORMAT('my_data'[Date], "Q") & " " & FORMAT('my_data'[Date], "YYYY") 

The following screenshot shows how to use this formula in practice:

Feel free to use whichever formula you prefer depending on how you would like the resulting quarter and year to be displayed.

Note: You can find the complete documentation for the FORMAT function in DAX here.

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

How to Convert Date to Text in Power BI
Power BI: How to Convert Date to Month and Year in Power BI
How to Replace Blank with Text in Power BI

Leave a Reply

Your email address will not be published. Required fields are marked *