Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

My SET expression now display YTD sales , How to modify so that it will display last 3 year instead of YTD ?

Hi Sir

My expression work fine :-

Sum(Aggr(SUM({<year = {'$(=Max(year))'}, month = {"<=$(=IF(GetSelectedCount(month), Max({<year = {'$(=Max(year))'}>}month), Num(Month(Today()))))"}>}sales/1000), GROUP_CLASS))

I don't know how to modify the above expression to compute last 3 year sales. Hope some one can advise me.

Paul

7 Replies
paulyeo11
Valued Contributor II

Re: My SET expression now display YTD sales , How to modify so that it will display last 3 year instead of YTD ?

my QVF

Re: My SET expression now display YTD sales , How to modify so that it will display last 3 year instead of YTD ?

I don't have app access, Perhaps this?

Sum(Aggr(SUM({<year = {">=$(=AddYears(Max(year),-3))<=$(=Max(year))"}, month = {"<=$(=IF(GetSelectedCount(month), Max({<year = {">=$(=AddYears(Max(year),-3))<=$(=Max(year))"}>}month), Num(Month(Today()))))"}>}sales/1000), GROUP_CLASS))

paulyeo11
Valued Contributor II

Re: My SET expression now display YTD sales , How to modify so that it will display last 3 year instead of YTD ?

Hi Anil

Thank you very much. it work.

Paul

paulyeo11
Valued Contributor II

Re: My SET expression now display YTD sales , How to modify so that it will display last 3 year instead of YTD ?

Hi Anil


I just try to change the -3 to any value for the below expression you given to me , i notice that it still display the same result :-


Sum(Aggr(SUM({<year = {">=$(=AddYears(Max(year),-3))<=$(=Max(year))"}, month = {"<=$(=IF(GetSelectedCount(month), Max({<year = {">=$(=AddYears(Max(year),-3))<=$(=Max(year))"}>}month), Num(Month(Today()))))"}>}sales/1000), GROUP_CLASS))


When i visit the label it display >=10/7/1902<=2018 which not seen right.


Paul


Re: My SET expression now display YTD sales , How to modify so that it will display last 3 year instead of YTD ?

Can you show that condition in text box and check?

paulyeo11
Valued Contributor II

Re: My SET expression now display YTD sales , How to modify so that it will display last 3 year instead of YTD ?

Hi Anil

Do you mean like this ?

condition click box.png

Re: My SET expression now display YTD sales , How to modify so that it will display last 3 year instead of YTD ?

Is that values are correct?

Capture.PNG

Community Browser