I am try to find sales for a selected month based on a (Date pram) for the current year and for the same month for last year...problem is I return the sales for the same month (good) but don't know how to have it call to last year and current year...not sure if the script is correct. any suggestions
//----------lastyear---------------
IF {?DateRangeType} = "Monthly" then
if date(dateadd("m", 0, dateadd("d", -365, {?Date }))) = ({DailySales_Summary_vw.SalesDate})then
if ({MMS_Store_Region_vw.Region}="USA")then
{DailySales_Summary_vw.Sales}* {?ExchRate}
else
{DailySales_Summary_vw.Sales}
//-----------currentyear------------
IF {?DateRangeType} = "Monthly" then
if date(dateadd("m", 0, {?Date })) = ({DailySales_Summary_vw.SalesDate})then
if ({MMS_Store_Region_vw.Region}="USA")then
{DailySales_Summary_vw.Sales}* {?ExchRate}
else
{DailySales_Summary_vw.Sales}
//----------lastyear---------------
IF {?DateRangeType} = "Monthly" then
if date(dateadd("m", 0, dateadd("d", -365, {?Date }))) = ({DailySales_Summary_vw.SalesDate})then
if ({MMS_Store_Region_vw.Region}="USA")then
{DailySales_Summary_vw.Sales}* {?ExchRate}
else
{DailySales_Summary_vw.Sales}
//-----------currentyear------------
IF {?DateRangeType} = "Monthly" then
if date(dateadd("m", 0, {?Date })) = ({DailySales_Summary_vw.SalesDate})then
if ({MMS_Store_Region_vw.Region}="USA")then
{DailySales_Summary_vw.Sales}* {?ExchRate}
else
{DailySales_Summary_vw.Sales}