Skip to Main Content
Spotfire Ideas Portal
Status Future Consideration
Product Spotfire
Categories Custom Expressions
Created by Guest
Created on Mar 11, 2021

Makes the fields in the BinByDateTime() function dependent like YearAndWeek()

To meet the user calendar, the user needs to make registry as the following: iFirstWeekOfYear=2.

And iFirstDayOfWeek=0. (Monday)

Function BinByDateTime("1/1/2021 1:01:01 AM","Year.Week",1) will return this value: 2021.53

While using YearAndWeek() function will return this: 202053

Obviously, the combinations ("Year and Week") used in the 2nd argument of the BinByDateTime() function seem to be independent entities as designed (they are not dependent on each other).


The request here is to get 202053 as output when using BinByDateTime() function as YearAndWeek() function.

  • Attach files
  • Guest
    Reply
    |
    Jan 23, 2023

    Please note that since Spotfire 12.2, the methods ISOYear and ISOWeek are available (and also BinByDateTime hierarchies using ISOYear and ISOWeek).

  • Guest
    Reply
    |
    May 2, 2022

    I agree that this needs to be fixed. Lots of users operate on an ISO week standard and Spotfire should have an easy way to bin by dates using that standard. Changing registry settings aligns the week to the standard but then the year is an issue since it is calculated independently.

  • Guest
    Reply
    |
    Jan 6, 2022

    Hi,

    we have the same issue that
    <BinByDateTime([DateTime],"Year.Week",1)>
    and
    YearAndWeek([DateTime])
    yield different results for e.g. 1-Jan-2022 namely

    2022-53 (which is wrong)
    and
    202152 (which is correct).

    The workaround suggested by Thomas yields yet another flavour which is
    2022-202152
    i.e. it would not fall together in the same bin with data e.g. from 31-Dec-2021 which would be
    2021-202152
    while both should be
    2021-52.


    I really think the behaviour of the BinByDateTime expression has a bug and I'm pretty sure many users are looking at their data drawing incorrect conclusions. This should be fixed in the next hotfix.

    Thanks, Mark

  • Guest
    Reply
    |
    Mar 22, 2021

    Thanks for the idea Anas. For now please use the expression:

    <BinByDateTime([Order Date],"Year.YearAndWeek",1)>

    This will give you to columns in a hierarchy and a slider.