Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

geogou1973
New Contributor II

compare current vs previous sales

Hello.

How can i compare the current sales vs previous sales giving only the current year date in the selections and the chart giving me also the previous sale date in the same period and in the same weekday. Also if i give the month compare automatically the sales in the previous year. Is there any set analysis to do this ?

Thank you in advance.

2 Replies
MVP
MVP

Re: compare current vs previous sales


Hi,

Try like this

For Current Selections

=Sum(Sales)

For Previous Year

=Sum({<Year=, Month=, Quarter=,Week=,DateDimension={'>=$(=YearStart(Max(DateDimension), -1))<=$(=YearEnd(Max(Date), -1))'}>}Sales)

In the above expression replace DateDimension with your date field name, Year with Year field etc.  Year= is used to ignore the selections.

Regards,

Jagan.

Not applicable

Re: compare current vs previous sales

Hi

for previous year

sum({<yearfield={"=$(=only(yearfiled)-1)"},quarterfiled=,monthfield={"=$(=max(monthfiled)-1)"}>}sales)

if month is in monthnames then use month number function.

Community Browser