Forum Discussion
nchinbong
10 years agoFrequent Visitor
Can you do if statements in Advanced Editor in Power Query?
Hi Everyone, I am loading a Fiscal Reference Date Dim that has 3 years in it, the current year and 2 prior years. There is a column for relative year where the current year is 0, one prior is -1 ...
AlexChen
Microsoft Employee
10 years agoHi,
You can use IF condition in Advanced Editor.
I assume your table looks like below.
You can use code below in Advanced Editor to get the records you mentioned.
let
Source = Table.SelectRows(#"yearInfo",
if Date.Month(DateTime.LocalNow()) = 11 and Date.Day(DateTime.LocalNow()) <= 15 then #"yearInfo" else each([relative year] <> -2))
in
Source
This is the result:
To know more details about the usage of power query, please take a look at https://msdn.microsoft.com/en-us/library/mt211003.aspx.
Best Regards
Alex