1. Senior Member
Join Date
Mar 2007
Posts
158

## 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...

2. Member
Join Date
Mar 2007
Posts
49
Hi, haven't you got the same problem with october or november (quarter=3 instead of 4) ?

3. Senior Member
Join Date
Mar 2007
Posts
158

## 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?

4. Chief Data Integration
Join Date
Nov 1999
Posts
9,729

## 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. Chief Data Integration
Join Date
Nov 1999
Posts
9,729
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. Junior Member
Join Date
Nov 2006
Posts
17
>> See also the sample transformation "General - Populate date dimension AU.ktr".
Which also calculates the wrong values (Kettle 2.4.0)...

7. Senior Member
Join Date
May 2006
Posts
4,882
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
•