Skip to Main Content
Spotfire Ideas Portal
Status Future Consideration
Product Spotfire
Categories Custom Expressions
Created by Guest
Created on May 25, 2017

Way to calculate number of working week day

We're looking for a simple way to calculate the number of working weekdays. In Spotfire, there is no simple function, but in Tableau, there is a "Weekday"DateDiff("weekday",[ORDER DATE],[DELIVERY DATE])In Spotfire, the closest I got is this reference page, with an absurdly long statementhttp://tibcoanalytics.com/spotfire/archive/totw/2010-01-23.html((((Integer(((Integer(DateDiff("day",[ORDER DATE],[DELIVERY DATE]) / 7) * 5) + DayOfWeek([DELIVERY DATE])) - DayOfWeek([ORDER DATE])) + (if((integer(DayOfWeek([ORDER DATE])));(integer(DayOfWeek([DELIVERY DATE]))),5,0))) - (if((integer(DayOfWeek([DELIVERY DATE])))=(6),1,0))) + (if((integer(DayOfWeek([DELIVERY DATE])));;(0),1,0))) + (if((integer(DayOfWeek([DELIVERY DATE])))=(0),1,0))) - (if((integer(DayOfWeek([ORDER DATE])))=(0),1,0))

  • Attach files
  • Guest
    Reply
    |
    Apr 2, 2019

    Hi all,

    you can download the extension via exchange.ai

    https://exchange.ai/downloads/datetimediff-calculation-method/

     

    Thanks,

    Michal

  • Guest
    Reply
    |
    Mar 8, 2018

    Listed formula gives integer value. We need something like DateDiff result. Also, if it is possible, feature like to define number of hours in a working day for different calculations. It makes analysis like support tickets / delivery on time easy. Thank you.

  • Guest
    Reply
    |
    Sep 11, 2017

    Hi Harold,

    we (MIA Solutions) implemented an extension that allows you to calculate the datediff excluding weekends + with working time definition. This is method description:

    **************************

    DateTimeDiffWork

    Calculates the working time difference between two datetime values
    (Saturdays and Sundays are excluded).
    Arg.1 = FromDateTime,
    Arg.2 = ToDateTime,
    Arg.3= FromWorkingTime,
    Arg.4 = ToWorkingTime.

    Example: DateTimeDiffWork(DateTime(2012,11,19,8,0,0,0),DateTime(2012,11,26,22,30,0,0),Time(9,0,0,0),Time(17,30,0,0))

    Output: 2.3:0:0.000

    **************************

    If that is what you are searching for, contact me via michal.jakubik@miasolutions.sk - I will be happy to discuss more details with you.

     

    Thanks,

    Michal

16 MERGED

Working Days function

Merged
I would like to calculate the number of working days between two days in Spotfire DXP (create a new column with the number of working days, calculated from two other columns, which contain a start and end date).
almost 9 years ago in Spotfire / Custom Expressions 1 Future Consideration
17 MERGED

To have a common function which would calculate number of working days in a month with month as input

Merged
To have a common function which would calculate number of working days in a month with month as input. By giving month name/number as input along with working day offset in so we can select first day of week, from that it should calculate the next...
almost 3 years ago in Spotfire / Data Functions 1 Future Consideration