Forum Discussion

MA_guy_VER's avatar
MA_guy_VER
Icon for Advocate I rankAdvocate I
3 years ago
Solved

Create a Filter from 8pm Yesterday through 8am today

Hello Community,   In the following data set from a HISTORY TABLE, I have operations that are picking items from 8pm (200000) the previous day (yesterday) through 8am (80000) today.   I would li...
  • Greg_Deckler's avatar
    3 years ago

    MA_guy_VER Try:

    Measure =
      VAR __Today = TODAY()
      VAR __Yesterday = __Today - 1
      VAR __Table = FILTER('Table', ( [Date] = __Yesterday && [Time] >= 80000 ) || ( [Date] = __Today && [Time] <= 200000) )
    RETURN
      SUMX(__Table,[Qty Picked])
  • rsbin's avatar
    rsbin
    3 years ago

    Greg_Deckler , MA_guy_VER ,

    I think Greg got the hours reversed.  Please re-try with this:

    Measure =
      VAR __Today = TODAY()
      VAR __Yesterday = __Today - 1
      VAR __Table = FILTER('Table', ( [Date] = __Yesterday && [Time] >= 200000 ) || ( [Date] = __Today && [Time] <= 80000) )
    RETURN
      SUMX(__Table,[Qty Picked])

     

  • rsbin's avatar
    rsbin
    3 years ago

    MA_guy_VER ,

    Yes, we are assuming your [Date] Column is a Date Field.  It looks to be more like a DateKey.

    So, in this case we need to convert the VAR _Today into a similar DateKey:

    VAR _Today = YEAR( Today() ) & MONTH( Today() ) & DAY( Today() )  
    VAR _Yesterday = _Today - 1

    Ensure your Date Column above is numeric