4 Replies Latest reply: Dec 3, 2013 4:02 PM by Henric Cronström RSS

    Load data from min and max date.

      Hello,

       

      I have a DimensionDate with dates from 1900 to 2018.

       

      My fact contains data from 2007-01-01 to today 2013-03-12

       

       

      How would you then do so i dont load all dates from my dimension (my listbox will show to many dates or years and so on)

      (I could do this in SQL where i select a hardcoded date, but i rather want to peek down into my fact table )

       

      Lets say i have this:

       

       

       

      FactSales:

      Amount

      DateKey

       

       

      LET vMinLoadDate = peek(FactSales,'DateKey',0)

      Let vMaxLoadDate = peek(FactSales,'DateKey,1)

       

      DimDate:

      DateKey (YYYYMMDD)

      Date_Clean (YYYY-MM-DD)

      and so on

      from xxxxx

      where DateKey between '($vMinLoadDate)' and '($vMaxLoadDate)'

       

      Am i able to do so? or how would you do it?