Link to home
Start Free TrialLog in
Avatar of judy pritz
judy pritz

asked on

Creating Peak and Off Peak Timebands

I have written a formula to split peak from off peak time, peak is only Monday to Friday, the result is only returning data for off peak, please see formula below;

  If ( (time({STAT_RM_TRANSACTIONS.TRIPDATETIME})>=timevalue(03,00,00) AND time({STAT_RM_TRANSACTIONS.TRIPDATETIME})<=timevalue(09,29,59))
          AND  (
          (time({STAT_RM_TRANSACTIONS.TRIPDATETIME})>=timevalue(15,30,00) AND time({STAT_RM_TRANSACTIONS.TRIPDATETIME})<=timevalue(17,59,59))
               )  AND      
          datepart("w",{STAT_RM_TRANSACTIONS.TRIPDATETIME}) IN [2,3,4,5,6] //weekdays
 
         ) THEN "Peak"

ELSE "Off Peak"
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of judy pritz
judy pritz

ASKER

Thank you, I knew it was something simple, sometimes you just need a fresh pair of eyes.
Logic problems are always the hardest to find. Have a great day.
logic error fixed