Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » BirtDuration.day
BirtDuration.day [message #547290] Fri, 16 July 2010 08:18 Go to next message
Nicola is currently offline NicolaFriend
Messages: 184
Registered: July 2009
Senior Member
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 13:38 Go to previous message
Richard A. Polunsky is currently offline Richard A. PolunskyFriend
Messages: 212
Registered: July 2009
Location: Houston TX
Senior Member

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;

Previous Topic:Data cube: add another column for aggregation
Next Topic:DataSource Property Binding
Goto Forum:
  


Current Time: Thu Apr 25 13:46:42 GMT 2024

Powered by FUDForum. Page generated in 0.03076 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top