Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ajmed1991
Contributor
Contributor

Sum value of field with value -1

Hi everyone, right now I have this Expression:

Sum({<[Tipo Fecha]={'M'}>}[Unidades Vendidas Ant])

Which gives you the the Sum based on a Year.

But I want to calculate it using The selected Year -2 and the selected Year -3.

I mean 2 years ago o 3 Years ago.

I tried something similar to:

Sum({<[Tipo Fecha]={'M'}>-2}[Unidades Vendidas Ant])

But it's not working.

 

Any suggestions or ideas?

Thanks a lot.

2 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

Try this for Year-2:

Sum({<[Tipo Fecha]={'M'}, Ano={$(=max(Ano)-2)}>}[Unidades Vendidas Ant])

Brett_Bleess
Former Employee
Former Employee

The following Design Blog post may be of some use in explaining things a bit too:

https://community.qlik.com/t5/Qlik-Design-Blog/Dates-in-Set-Analysis/ba-p/1472511

If the partners response did get you what you needed, we would appreciate it if you would close out the thread by using the Accept as Solution button on their post, which will give them credit for the help and let other Members know that worked.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.