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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

DAX Date Sorting

Hi,

 

I am sorting NBA data into season and season type.

 

For the 2012-2013 season.

 

Season Type = SWITCH(TRUE(),

'Merge1'[Date] >= DATE(2012,10,5) && 'Merge1'[Date] <= DATE(2012,10,29), "Preseason",

'Merge1'[Date] >= DATE(2012,10,30) && 'Merge1'[Date] <= DATE(2013,04,19), "Regular season",

'Merge1'[Date] >= DATE(2013,04,20) && 'Merge1'[Date] <= DATE(2013,06,5), "Playoffs",

'Merge1'[Date] >= DATE(2013,06,06) && 'Merge1'[Date] <= DATE(2013,06,20), "Finals",

'Merge1'[Date] >= DATE(2013,06,21) && 'Merge1'[Date] <= DATE(2013,10,4), "Offseason"

 

I have 8 seasons of data.

 

Each season has different starting dates for the preseason, regular season etc.

 

Would I have to copy and alter this code for each of the 8 seasons .

 

Or is there an alternative?

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 


 

 Would I have to copy and alter this code for each of the 8 seasons .

 

Or is there an alternative? 


I think you may have to copy and alter this code for each season data.

 

Regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
tarunsingla
Solution Sage
Solution Sage

Not sure what all data you have, but you can dump the season metadata like season, season type, start date and end date in another dataset and then create a relationship between your actual datset and the season metadata. You wont need to duplicate this dax then and can work with season start date and end date alone.
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 


 

 Would I have to copy and alter this code for each of the 8 seasons .

 

Or is there an alternative? 


I think you may have to copy and alter this code for each season data.

 

Regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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