Hi,
I am currently using the excellent date table M code from the resources to create my date table in my Data model.
My company is based on a Fiscal Period of ‘Period 1 to Period 13’ which starts every September of each year.
Period 1, Week 1,2,3,4 and then Period 2 Etc. etc… Week Commencing is always Sunday Dated.
Please see attached excel screenshot.
I would like to incorporate this into my Lookup Date Table.
What’s the best approach? DAX or an M Code workaround? (Tweaking the M Code)
I am currently using a Switch(True) solution in a calculated column within my Date Table to achieve this. - My code is below for my Calculated Column ‘Period’ (Period 8 to 13)
My question is? Is there a better way of obtaining the same solution? (I’m still quite new to DAX)
Period =
SWITCH (
TRUE (),
AND (
‘DIM Dates Table’[Date] >= DATE ( 2020, 4, 19 ),
‘DIM Dates Table’[Date] <= DATE ( 2020, 5, 9 )
),
8,
AND (
‘DIM Dates Table’[Date] >= DATE ( 2020, 5, 10 ),
‘DIM Dates Table’[Date] <= DATE ( 2020, 6, 6 )
),
9,
AND (
‘DIM Dates Table’[Date] >= DATE ( 2020, 6, 7 ),
‘DIM Dates Table’[Date] <= DATE ( 2020, 7, 4 )
),
10,
AND (
‘DIM Dates Table’[Date] >= DATE ( 2020, 7, 5 ),
‘DIM Dates Table’[Date] <= DATE ( 2020,8, 01 )
),
11,
AND (
‘DIM Dates Table’[Date] >= DATE ( 2020, 8, 2 ),
‘DIM Dates Table’[Date] <= DATE ( 2020, 8, 29 )
),
12,
13
)
Thanks Darren