BirtDuration.day [message #547290] |
Fri, 16 July 2010 04:18  |
Eclipse User |
|
|
|
Hi,
I need to get a quantity per day from a cube.
My cube shows quantity for each month and I want to add a second line to
calculate the average quantity per day.
To do that I have to know how many days has a month.
I read that Birt has a BirtDuration.day(lexicalDuration) function, but I
didn't understand how to pass my month.
Any suggestions, please?
Thank you
nicola
|
|
|
Re: BirtDuration.day [message #547370 is a reply to message #547290] |
Fri, 16 July 2010 09:38  |
Eclipse User |
|
|
|
I don't think you want to mess around with a lexicalDuration anyway. All you want is to take an amount and a month and compute a daily average. You can do that with a fairly straightforward javascript.
There are some libraries out there which provide a "daysInMonth" function - that would simplify your life but I don't think we have it available to us.
I'll leave the specific syntax of some of the functions to you as I'm not in my environment.
Given as available fields [amount] and [date]
If [date].Month in [9,4,6,11] then [amount] / 30.0;
If [date].Month in [1, 3, 5, 7, 8, 10, 12] then [amount] / 31.0;
If [date].Month = 2 and [date].Year mod 4 = 0 then [amount] / 29.0;
If [date].Month = 2 and [date].Year mod 4 != 0 then [amount] / 28.0;
|
|
|
Powered by
FUDForum. Page generated in 0.04115 seconds