Forum Discussion

BrettM's avatar
BrettM
Frequent Visitor
2 years ago
Solved

Previous Days Orders

We have a eComm program in place where we ship all orders received by 2 PM same day.  This means when looking at orders the timing for "Today's orders needs to be calculated from 2:01 PM yesterday to 2:00 PM today. 

I am looking to produce a table based upon a date that is -10 hrs from Today to +14hrs into today. 

How best to perform this?

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi BrettM ,

     

    You can try below formula:

    FilteredOrders = 
    CALCULATETABLE (
        VALUES ( 'YourTable'[OrderID] ),
        FILTER (
            'YourTable',
            'YourTable'[OrderTimestamp]
                >= NOW () - 1
                    + TIME ( 14, 0, 0 )
                && 'YourTable'[OrderTimestamp]
                    < NOW () - 1
                        + TIME ( 14, 0, 0 ) + 1
        )
    )

     

     

    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • BrettM , Create a new date column  using your date time column

     

    Date 1 = if(Timevalue([DateTime]) > Time(14,0,0) , Datevalue([DateTime])+1, Datevalue([DateTime]))

    • BrettM's avatar
      BrettM
      Frequent Visitor

      I may have not explained it well.  Any orders received in the below-mentioned "Days/Hours Received" would belong to the "Processing Days". Example of how they are to be treated below. 

       

      Processing DaysDays/Hours Received
      MondayFriday - 1:30 PM - Monday 1:29 PM
      TuesdayMonday - 1:30 PM - Tuesday 1:29 PM
      WednesdayTuesday - 1:30 PM - Wednesday 1:29 PM
      ThursdayWednesday - 1:30 PM - Thursday 1:29 PM
      FridayThursday - 1:30 PM - Friday 1:29 PM
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi BrettM ,

     

    You can try below formula:

    FilteredOrders = 
    CALCULATETABLE (
        VALUES ( 'YourTable'[OrderID] ),
        FILTER (
            'YourTable',
            'YourTable'[OrderTimestamp]
                >= NOW () - 1
                    + TIME ( 14, 0, 0 )
                && 'YourTable'[OrderTimestamp]
                    < NOW () - 1
                        + TIME ( 14, 0, 0 ) + 1
        )
    )

     

     

    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.