1 Reply Latest reply on Dec 7, 2018 8:18 AM by Norbert Maijoor

    Need to calculate the average number of discharges on weekdays and weekends

    Peter Honious

      I have down the number of discharges by weekday and weekend.

       

      if DATENAME("weekday",[Discharge Full Date]) = "Monday"

      or DATENAME("weekday",[Discharge Full Date]) = "Tuesday"

      or DATENAME("weekday",[Discharge Full Date]) = "Wednesday"

      or DATENAME("weekday",[Discharge Full Date]) = "Thursday"

      or DATENAME("weekday",[Discharge Full Date]) = "Friday"  

      then 1 ELSE 0 END

       

       

      if DATENAME("weekday",[Discharge Full Date]) = "Saturday"

      or DATENAME("weekday",[Discharge Full Date]) = "Sunday"

       

      then 1 ELSE 0 END

       

       

      I can figure out how to calculate the average for each.

        • 1. Re: Need to calculate the average number of discharges on weekdays and weekends
          Norbert Maijoor

          Hi Peter,

           

          Not sure but find my approach as reference below and stored in attached workbook version 10.5 located in the original thread.

           

           

          1. Define D1. Order Date (Weekdays)

           

          weekdays.png

           

          2. Define D2. Order Date (Weekdays) (group)

           

           

          group.png

           

          3. Define M1. count OrderID: countd([Order ID])

           

          4. M2. Fixed count: {fixed [D3. Order Date (Years)],[D2. Order Date (Weekdays) (group)]:([M1. count OrderID])}

           

          5. M3. Avg:

          if attr([D2. Order Date (Weekdays) (group)])='Week' then sum([M2. Fixed count])/5

          elseif attr([D2. Order Date (Weekdays) (group)])='Weekend' then sum([M2. Fixed count])/2

          END

           

          6. Drag the required objects to the indicated locations

           

          drag.png

           

           

          Hope it helps,

           

          Regards,

          Norbert