Forum Discussion
Anonymous
4 years agoNot applicable
Date table with fiscal week numbers
Hi Can i get some advice on how to write a date table with fiscal week number please . our company fiscal week starts on the first week of april and ends on the last week of march the following ...
- 4 years ago
Hi Anonymous ,
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.
Anonymous
4 years agoNot applicable
Hi mwegener
Thanks for the reply and i have tried but there is an error message says
Token Eof expected and not sure what happened as i did copy your code & pasted in. Screen shot below.
Thanks
mwegener
Most Valuable Professional
4 years agoHi Anonymous ,
the code is not M (Power Query), but DAX.
Maybe this helps
let
Source = List.Range({0..52}, 1),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Week Number"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Week Number", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Fiscal Week Number", each if [Week Number] - 32 + 1 <= 0 then 52 + [Week Number] - 32 + 1 else [Week Number] - 32 + 1),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Fiscal Week Number", Int64.Type}})
in
#"Changed Type1"