Reusable, Simple, & Easy ISO Week Calculation with TIBCO Spotfire

ISO is an international standard for representation of dates and times. It was issued by the International Organization for Standardization (ISO) and was first published in 1988. The most important purpose of this standard is to provide an unambiguous and well-defined method of representing dates and times, in order to avoid misinterpretation of numeric representations of dates and times, particularly when data transfer happens between countries with different conventions for writing numeric dates and times.

ISO week date is defined in Wikipedia as leap week calendar system. A date is specified by the ISO week-numbering year in the format YYYY, a week number in the format ww prefixed by the letter ‘W’, and the weekday number, a digit d from 1 through 7, beginning with Monday and ending with Sunday.

ISO week in TIBCO Spotfire

There are multiple ways to calculate ISO week in TIBCO Spotfire. Two simple and easy ways to perform this calculation are through data functions and expression functions.

Since this standard has been out since 1988, there are lots of pre-existing solutions for this calculation. One of the CRAN packages that can easily help is ISOWeek. Click here for detailed documentation about the package.

The first step requires installing the package ISOweek using TERR tools:

ISOweek package Reusable, Simple, & Easy ISO Week Calculation with TIBCO Spotfire

Once the package is installed, you can either use data functions or expressions to perform the calculation. In this example, ISOweek function defined in the package is used to calculate ISO week

ExpressionISOweek Reusable, Simple, & Easy ISO Week Calculation with TIBCO Spotfire

ISOweek would be one of the available functions. Please note that it is a column function and return type is string.

You can also create a data function, which can add a new column to existing data table. Here is sample data function that appends a column to existing data in Spotfire.

ISOweek DF Reusable, Simple, & Easy ISO Week Calculation with TIBCO Spotfire

Both these methods result in additional column that is of type String.

ISOweekoutput Reusable, Simple, & Easy ISO Week Calculation with TIBCO Spotfire

Want to try these tips and our other tricks for yourself in TIBCO Spotfire? Start a free Spotfire trial today.

Let’s block ads! (Why?)

The TIBCO Blog