cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HarshaTU Resolver I
Resolver I

Generate Custom Quarters using date column

Hi,

 

I have a date column that has dates from 01/01/2018 to 30/09/2019. Using this date field by default I can get calendar Quarters.

But my requirement is to generate custom quarters using specific date intervals as below,

 

27 September 2018 to 31 Dec 2018 - Q4-2018

01 Jan 2019 to 4th March 2019       -  Q1-2019

5th March 2019 - 27th June 2019   -  Q2-2019

28th June 2019 - 30th September 2019 - Q3-2019

 

can some one help me in getting the Custom Quarters as above?

 

A quick help would be much appreciated

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV
Super User IV

Re: Generate Custom Quarters using date column

Use a SWITCH statement like:

 

Quarter = 
  SWITCH(
    TRUE(),
    [Date] >= DATE(2018,9,27) && [Date] <= DATE(2018,12,31),"Q4",
    [Date] >= DATE(2019,1,1) && [Date] <= DATE(2019,3,4),"Q1",
    [Date] >= DATE(2019,3,4) && [Date] <= DATE(2019,9,30),"Q2",
    "Q3"
)

---------------------------------------

Not the Power BI thought police...

I have NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Super User IV
Super User IV

Re: Generate Custom Quarters using date column

Use a SWITCH statement like:

 

Quarter = 
  SWITCH(
    TRUE(),
    [Date] >= DATE(2018,9,27) && [Date] <= DATE(2018,12,31),"Q4",
    [Date] >= DATE(2019,1,1) && [Date] <= DATE(2019,3,4),"Q1",
    [Date] >= DATE(2019,3,4) && [Date] <= DATE(2019,9,30),"Q2",
    "Q3"
)

---------------------------------------

Not the Power BI thought police...

I have NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

View solution in original post

HarshaTU Resolver I
Resolver I

Re: Generate Custom Quarters using date column

@Greg_Deckler  Thanks for the quick response. It worked.

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors