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
vanessafvg
2 years agoCommunity Champion
i have never written an iif statement in sql, and ive done sql development for over 25 years 🙂 sql uses a case statement for if.
SamWiseOwl
2 years agoSuper User
Ahh so Case is better performance than IIF ? That is good to know thank you! vanessafvg Always happy for advice from the masters.
One that blew my mind was dragging the columns in the results pane, when was that added 🤔😂