I'm trying to use a variable in power query to save on adding same fuction twice but can't get it to work;
What i'm trying to replace is ; Date.QuarterOfYear (
(A, B ) =>
let
Start =
List.Dates(A, (Number.From(B-A)+1), #duration(1,0,0,0) ),
ToT = Table.FromColumns( { Start } , { "Date"} ) ,
FQ = Table.AddColumn( ToT, "Fiscal Q", each if Date.QuarterOfYear([Date]) =1 then 4 else Date.QuarterOfYear([Date])-1)
in
FQ
Which works
And I'd like to add Date.Quarter as a step and then use it; I've tried
(A, B ) =>
let
Start =
List.Dates(A, (Number.From(B-A)+1), #duration(1,0,0,0) ),
ToT = Table.FromColumns( { Start } , { "Date"} ) ,
Quar = Date.QuarterOfYear([Date]) ,
FQ = Table.AddColumn( ToT, "Fiscal Q", each if Quar = 1 then 4 else Quar -1 )
in
FQ
Not sure which part is wrong or if I need to declare the Quarter in a different way.
Richard
Bookmarks