Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
WJ876400
Helper IV
Helper IV

If Statement With Dates

Hi

 

I have the below dates and want to group them togerther in Terms. So if a date is between September and December it is Term 1, between January-April is Term 2, May-August is Term 3. I am looking at the month in the date. What is the best way to do this?

 

thanks

 

01/01/2020Term 2
01/02/2020Term 2
01/03/2020Term 2
01/04/2020Term 2
01/05/2020Term 3
01/06/2020Term 3
01/07/2020Term 3
01/08/2020Term 3
01/09/2020Term 1
01/10/2020Term 1
01/11/2020Term 1
01/12/2020Term 1

 

thanks

1 ACCEPTED SOLUTION
Gordonlilj
Solution Sage
Solution Sage

Hi,

 

You could achieve this by using MONTH in a SWITCH function like below

 

Term = 
SWITCH(TRUE(),
MONTH('Table'[Date]) >=1 && MONTH('Table'[Date]) <=4,"Term 2",
MONTH('Table'[Date]) >=5 && MONTH('Table'[Date]) <=8,"Term 3",
MONTH('Table'[Date]) >=9 && MONTH('Table'[Date]) <=12,"Term 1")

 

 

View solution in original post

1 REPLY 1
Gordonlilj
Solution Sage
Solution Sage

Hi,

 

You could achieve this by using MONTH in a SWITCH function like below

 

Term = 
SWITCH(TRUE(),
MONTH('Table'[Date]) >=1 && MONTH('Table'[Date]) <=4,"Term 2",
MONTH('Table'[Date]) >=5 && MONTH('Table'[Date]) <=8,"Term 3",
MONTH('Table'[Date]) >=9 && MONTH('Table'[Date]) <=12,"Term 1")

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.