Forum Discussion
DAX CALENDARAUTO()
- 6 years ago
Looks good. You can simplify the switch statements to either
SWITCH (TRUE(),[MonthNumber] in {11,12,1},"Q2" ,[MonthNumber] in {2,3,4},"Q3" ,[MonthNumber] in {5,6,7},"Q4" ,[MonthNumber] in {8,9,10},"Q1" ,blank() )or
SWITCH ([MonthNumber],1,"Q2",2,"Q3",3,"Q3",4,"Q3",5,"Q4",6,"Q4", 7,"Q4",8,"Q1",9,"Q1",10,"Q1",11,"Q2",12,"Q2",blank() )
Either that (and ADDCOLUMNS()) , or a totally external table that comes from SQL server, Excel, or even a CSV.
If you are ok to continue with this topic, I have updated my model from your last reply, or would you prefer this discussion is now closed?
So I took on board what you said about ADDCOLUMNS, I don't have the option of a date table from SQL or excel so I would be creating a version in my model. Below is what I have compiled, I will admit I have taken a few snippites from various sources, some examples out there are just too in depth and I would not fully understand what I was using. Hopefully what I am doing here is still considered to be good practice -
So I applied just some small amounts of DAX to get the results in my 'dimDate' table (shown below as a screen print).
Dax: