0 votes
1 view
in BI by (17.6k points)

We have a date column and I would like to create a new column in Power BI in YYYY Q(quarter number) format.

For example, if the date is 11/21/2017 then the new column should store 2017 Q4. Later we would like to use the newly calculated column as a slicer on our report.

What is the best approach to achieve this?
For example please find the sample data below.
11/21/2018 will be 2018 Q4 in a new column
10/12/2017 will be 2017 Q4 in a new column
02/11/2016 will be 2016 Q1 in a new column
07/10/2018 will be 2018 Q3 in a new column

1 Answer

0 votes
by (47.2k points)
  • We will use FORMAT where TableName[ColumnName] is the table column where your dates are:

= FORMAT(TableName[ColumnName], "yyyy \Qq")

  •  \ is an escape character so it knows to interpret Q literally, yyyy is the year, and q is the quarter number.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !