Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: date transformation problem

  1. #1
    Join Date
    Mar 2007
    Posts
    158

    Default date transformation problem

    Hi all,

    I have started evaluating kettle integration tool.
    I have problem in calculating quarter using calculator functions.
    I have order date coming from a table I want to calculate the qurter number based on month number.
    everything is going fine but I m getting wrong quarter number for july month.It say 2nd quarter for july.
    I m attaching my transformation.
    I m also attaching my calculator's snapshot.
    pls help me in that.
    or give me any other way to solve this problem for calculating quarter of year.

    Thanks...
    Attached Images Attached Images  
    Attached Files Attached Files

  2. #2

    Default

    Hi, haven't you got the same problem with october or november (quarter=3 instead of 4) ?

  3. #3
    Join Date
    Mar 2007
    Posts
    158

    Default nop

    I hope u have gone through my transformation...
    its showing wrong quarter number with the june and july.
    not with oct or nov.

    Do u have any solution for this?
    Thanks for reply

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default Quarter calculation

    You would think that calculating a quarter is very simple, but in fact it's not.
    It seems that the trick is to do this:

    quarter = round(0.33 + MonthNr/2.9)

    I think it was found by BizCubed Pty Ltd. See also the sample transformation "General - Populate date dimension AU.ktr".

  5. #5
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Well, an easier solution can also be to simply create a value mapper:

    Month --> Quarter
    1 --> 1
    2 --> 1
    3 --> 1
    4 --> 2
    5 --> 2
    6 --> 2
    7 --> 3
    8 --> 3
    9 --> 3
    10 --> 4
    11 --> 4
    12 --> 4

  6. #6
    Join Date
    Nov 2006
    Posts
    17

    Default

    >> See also the sample transformation "General - Populate date dimension AU.ktr".
    Which also calculates the wrong values (Kettle 2.4.0)...

  7. #7
    Join Date
    May 2006
    Posts
    4,882

    Default

    Not in 2.5 ... In 2.5 it's ok, just previewed the quarters of the year for 1950. The AU version, not the other, the other is still wrong.

    Regards,
    Sven

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.