Forum Discussion
Sorting Dates
- Anonymous7 years ago
Hi v-jiascu-msft,
I am sorting NBA dates 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
Anonymous
Hi,
Thanks for the response.
When you mention "if a period goes from December to January, you switch begin and ends like in the example"
Are you referring to this section
dateWithoutYear > 0631 && dateWithoutYear < 0301), "Season",
Also if I have five seasons of data and each season begins on a different date.
Would I have to repeat the season type section five times to account for this ?
Thanks,
Hi Anonymous,
If the dates start from different dates without any rules, I'm afraid you have to repeat them. Can you share the details, please?
Best Regards,
- Anonymous7 years agoNot applicable
Hi v-jiascu-msft,
I am sorting NBA dates 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
- Anonymous7 years agoNot applicable
Hi Anonymous
Thanks for your example. If those dates aren't stores somewhere or there is no specific logic, I'm afraid that you indeed have to assign that for each season.
But if you can find a table (on the web for example?) we can relate those dates to your table and categorize based on that.
Did I answer your question? Mark my post as a solution- Anonymous7 years agoNot applicable
Hi Anonymous ,
Thanks for your help,
I will try to find a table that includes these dates.