Forum Discussion
galpic2
2 years agoFrequent Visitor
How to filter initial data pull using today's date as a reference for another column
Hi all, Very new to Power BI and I've been searching the internet for help on this issue and haven't had much luck. I've got a very basic query below and just cannot figure out how to get this co...
- 2 years ago
sql doesn't use iif statements for the record
your where clause could look something like this.
assuming you can do a cte (common table expression) in snowflake
with cte_fiscal as (
select
max(FIS_YR_ID) as max_year
from
tablename
where
day = dateadd('day', -1, currentdate())
)
select
*
from
tablename
cross join cte_fiscal cte
where
FIS_YR_ID >= max_year -2
and FIS_YR_ID <= max_year
SamWiseOwl
2 years agoSuper User
Good to know, thank you vanessafvg! I couldn't tell which brand of SQL they were writing, since this is a Microsoft Forum I assumed T-SQL which does support IIF.
vanessafvg
2 years agoCommunity Champion
interestingly in later version it does seem to have this syntax available, so my bad, however i see it still converts it to a case statement anway