3 Replies Latest reply: Apr 18, 2012 2:33 AM by Baru -

# How to calculate last 3months distinct outlet covered

Hi,

I am trying to get last 3 months distinct outlet covered in text object.by month wise values showing correct,but i want to display last 3months outlet count.

ex:- when i am selecting Jan month,i want to display Dec,Non,Oct outlent count.

i am using this expression,

=((count({\$<YEAR = {\$(=only(YEAR) - \$(=if(only(MONTH) = 1, 1, 0)))}, MONTH = {\$(=month(addmonths(MonthYear, -1)))},ClosingStock={'>0'}>}
distinct IF(AHC_CallDate = MX_DATE, AHCHdr_Outlet_Code))) --------this is for Dec
+
(count({\$<YEAR = {\$(=only(YEAR) - \$(=if(only(MONTH) <= 2, 1, 0)))}, MONTH = {\$(=month(addmonths(MonthYear, -2)))},ClosingStock={'>0'}>}
distinct IF(AHC_CallDate = MX_DATE, AHCHdr_Outlet_Code)))------------------this is for Nov
+
(count({\$<YEAR = {\$(=only(YEAR) - \$(=if(only(MONTH) <= 3, 1, 0)))}, MONTH = {\$(=month(addmonths(MonthYear, -3)))},ClosingStock={'>0'}>}
distinct IF(AHC_CallDate = MX_DATE, AHCHdr_Outlet_Code))))-----------------this is for Oct

by giving month wise it showing correct values.

reg,

ba

• ###### How to calculate last 3months distinct outlet covered

hi,

Try using this Expression:

Where begingdate is date and specify its format, Mon is month derrived from begindate

• ###### How to calculate last 3months distinct outlet covered

Hi,

Try this expression

=Sum(Aggr(count({\$<MONTH=, DateFieldName={'>=\$(MonthStart(Max(DateFieldName), -2))<=\$(=Max(DateFieldName))}, ClosingStock={'>0'}>} distinct IF(AHC_CallDate = MX_DATE, AHCHdr_Outlet_Code)), MONTH))

Hope it helps you.

Regards,

Jagan.

• ###### How to calculate last 3months distinct outlet covered

Hi All,