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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sossie07
New Member

newbie date table question with "Growing Season" column

Hi all,

 

New to Power BI. I'm trying to chart Growing Degree Days (which is a temperature/weather related thing), by crop growing season.

 

I'm in the the southern hemisphere, so our growing season is September - April. I would like to have a "Season" colum in the date table. And as an example Season20-21 would indicate any date between 1 September 2020-30 April 2021.

 

I've read a bit about doing date tables in DAX vs M or others, I think I'm happy to do this in DAX.

 

I have found plenty of examples using financial periods, but not sure how to best to go about doing this based on the above.

 

Any ideas or staring pointers appreciated.

 

thanks

2 REPLIES 2
amitchandak
Super User
Super User

@sossie07 , In your date table create a new column like

 

season =

var _year = Switch(True(), month([date]) >=9 ,year([Date]) ,

month([date]) <=4 ,year([Date]) -1 )

return

 if(month([date]) >=9 && month([date]) <=4,"Switch " & _year & "-" & (_year +1) , blank())

Thanks Amitchandak,

I couldn't actually get your solution to work, but it got me started.

I ended up with this:

season1 = SWITCH(TRUE(),MONTH('Date'[Date]) >= 9, "Summer" & CONVERT(YEAR('Date'[Date]),STRING) & "-" & CONVERT(YEAR('Date'[Date])+1,STRING),MONTH('Date'[Date]) <= 4, "Summer" & CONVERT(YEAR('Date'[Date])-1,STRING) & "-" & CONVERT(YEAR('Date'[Date]),STRING), BLANK())

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors