Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Can you do if statements in Advanced Editor in Power Query?

$
0
0

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 and two prior is -2. My report typically would have 2 fiscal years except for a period of 3 weeks at the beginning of a new fiscal year where there would be 3 fiscal years. Currently when I load the Dim table, I filter out the second fiscal year. In the advanced editor, it looks like this:

 

#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([RLTV_FISC_YR_NR] <> -2)),

 

I am wondering if there is a straight forward way to stick an if statement in there? For example, if today's month is November AND todays day is less than or equal to 15 then load all 3 years else do not load relative year -2.

 

I can think of a round about way of creating a table to determine which years to load and then joining the tables to get a single table. I just didn't want to create this kind of work around if there was a straight forward way of doing it in the Advnaced Editor.

 

Thanks in Advanced. I'm just getting started with M.


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>