Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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.

If you are preparing for the Power BI certification exam, then take up this Power BI online training by Intellipaat that offers instructor-led training, hands-on projects, and certification. 

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...