Tuesday, March 27, 2012

Determine month from inside month row grouping

Hi guys,

i have a matrix that has two row groups, the first is month, the next is year. This is for year on year reporting, so the first two cells in each row are like this:

April 2005

April 2006

April 2007

May 2005

May 2006

May 2007

etc

in one of the columns of the matrix, i need to calculate a "per hour" figure, so i need to determine how many hours are in the month that groups this row.

So what i need to know is: how can i tell what month this row is? I don't care if the month is represented as text ("April") or an int (4), because the pseudo code for the expression will be:

<monthly dollar amount> / (24 * DateDiff("d", CDate("2006-<this month>-01"), DateAdd("M", CDate("2006-<this month>-01"), 1)))

Thanks for any suggestions!

sluggy

Duh, that was a stupid question... the answer was just to use the month dataset member as per usual This was the final expression for getting the number of hours in the month:

24 * DateDiff("d", CDate("2006-" + Fields!Calendar_Month.Value + "01"), DateAdd("M", 1, CDate("2006-" + Fields!Calendar_Month.Value + "01")))

No comments:

Post a Comment