Forum Discussion

galpic2's avatar
galpic2
Frequent Visitor
2 years ago
Solved

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...
  • vanessafvg's avatar
    vanessafvg
    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