Below formula gives the YTD (Jan2010 to Till date) average for CurrentRankVar
=Average(If< Received Date>>RelativeDate(CurrentDate() ,-DayNumberOfYear(CurrentDate())) Then <CurrentRankVar> Where( <PSL NA Core>="F1"))
I need code where I should get the average for LastYear (2009) provided ReceivedDate variable has the dates. Some RelativeDate function logic is required but not sure how to make it. Any help to achive this will be greatly appreciated.
Thanks…
=Average(If< Received Date>>RelativeDate(CurrentDate() ,-DayNumberOfYear(CurrentDate())) Then <CurrentRankVar> Where( <PSL NA Core>="F1"))
John,
I would think you were pretty close with the Use of a Where clause. Can you create a “Flag” Variable that is based on identifying the Previous Year? If so, then you could use something like:
The only thing I can think of offhand is that the -365 for determining previous year may not work for a leapyear (if run on the last day of the year).
For something like that, I usually take the Year of the CurrentDate and subtract one. That’s normally enough of a work around (in the very very unlikely case that someone runs the report on New Years eve on a leap year).
Otherwise, without seeing the data, the code looks fine to me.
Yeah, this solution also sounds good.
I used the new solution to one of my count formula and it is not working.
The formula is as below, basically I am counting all the names from previous year and it just returns 1
Thanks Digpen , that worked perfect.
One last thing, How about this YTD Formula. I am little suspicious , the numbers are coming and seems to be OK however, I wanted to confirm with the syntax.
AverageYTD=Average(If<Received Date>>RelativeDate(CurrentDate() ,-DayNumberOfYear(CurrentDate())) Then <CurrentRankVar> Where( <PSL NA Core>="F1"))
Hi Digpen,
Just an update on this formula. If I use count function the number goes wrong,
=Count(If Year(<Received Date>) = Year( CurrentDate() ) Then <Name>)
I expect 18 but returns only 1 (Becuse the detailed report has 18 rows with Name) . Is the formula evaluating wrong? Also, I am placing the formula in a Cell.