Forum Discussion

clarkpaul's avatar
clarkpaul
Helper I
2 years ago
Solved

Limit Data Retrieval Based on Friday Dates

Our data warehouse has a daily snapshot of inventory.  I want to show trends over time on a weekly basis (every Friday). I have a dynamic date table that has every date from 1/1/2024 to current date...
  • ahadkarimi's avatar
    2 years ago

    Try this code, If you have any questions or need more info, just hit me up!

    let
    Fridays = YourFridaysListQuery,
    Source = Odbc.DataSource("dsn=Snowflake", [HierarchicalNavigation=true]),
    MAC_RAPID_PROD_Database = Source{[Name="MAC_RAPID_PROD",Kind="Database"]}[Data],
    APPS_Schema = MAC_RAPID_PROD_Database{[Name="APPS",Kind="Schema"]}[Data],
    FACT_SCM_ONHAND_DETAILS_SNAPSHOT_V_View = APPS_Schema{[Name="FACT_SCM_ONHAND_DETAILS_SNAPSHOT_V",Kind="View"]}[Data],
    FilteredData = Table.SelectRows(FACT_SCM_ONHAND_DETAILS_SNAPSHOT_V_View, each List.Contains(Fridays, [SNAPSHOT_DATE]))

    in
    FilteredData