Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
akpofureenughwu
Contributor III

Previous Year Vs Current Year Sales figure

Good day everyone,

I have a set of data in this form

S/NProductActualTargetDateContract Type
1Soap40050001/01/2016SB
2Rice50001000001/01/2016SB
3Soap67080001/01/2017JB
4Soap1300200001/06/2016SB
5Rice1400300001/06/2017JB

In my attempt to show sales for all products for the current year and previous year.. I used these expressions:

Sum({<Year = {"$(=Max(Year))"}, Year >} Actual ) and Sum({<Year = {"$(=Max(Year)-1)"}, Year >} Actual) but my result is showing the same value?

I also used this expression Max(Aggr(Sum(Actual), Date)) to show the maximum actual sales values. It worked but I need to narrow it down to particular products like max actual sales for soap only?

Please can you help me review the expressions?

Regards

5 Replies

Re: Previous Year Vs Current Year Sales figure

Remove Year field from expression.

Sum({<Year = {"$(=Max(Year))"} >} Actual )

and

Sum({<Year = {"$(=Max(Year)-1)"} >} Actual)

Re: Previous Year Vs Current Year Sales figure

Are you going to ignore the Year selection in analysis?

Sum({<Year = {"=Only({$<Year=>} Year) = $(=Max(Year))"}, Year >} Actual )

Sum({<Year = {"=Only({$<Year=>} Year) = $(=Max(Year)-1)"}, Year >} Actual)


And Here we go for restrict the data to only one Product

Max(Aggr(Sum({<Product = {"Soap"}, Year=>} Actual), Date))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
akpofureenughwu
Contributor III

Re: Previous Year Vs Current Year Sales figure

Hello Anil

I am using the year selection.

load*,

'Q'&ceil(month(date#([Month],'MMM'))/3) as [Quarter],

'Day '&Day("Date")&' '&Month as [Day Number];

load*,

Year("Date") as Year,

Month("Date") as Month,

Day("Date") as Day;

I used the above script to convert date into year

Re: Previous Year Vs Current Year Sales figure

That is what my expression do, Here, Year can exclude the selection for analysis.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

Re: Previous Year Vs Current Year Sales figure

Find the atatched and have a look on the expressions on the chart.