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: 
Not applicable

Sum with set analysis

Hi,

I have the following expression: sum(AVAIL_1)/sum(AVAIL_2)

the result of this expression bring to me the sum of all avails from all weeks, but I need to filter just the avails of the last four weeks (SEMANA)

i wrote the following:

sum({< SEMANA = {'>$(=max(SEMANA) - 4'}>} AVAIL_1)/sum({< SEMANA = {'>$(=max(SEMANA) - 4'}>} AVAIL_2))


but doesn't works.


How can I fixe this?

Thank you!



2 Replies
salto
Specialist II
Specialist II

Hi Rafael,

this works for me:

sum({< SEMANA = {">=$(=(Max(SEMANA) - 4))"}>} AVAIL_1)

/

sum({< SEMANA = {">=$(=(Max(SEMANA) - 4))"}>} AVAIL_2))


Hope this helps!

javier_florian
Creator III
Creator III

You can try with this:

=Sum({<Semana={">=$(=Num(Max(Semana))-2)<=$(=Num(Max(Semana)))"}>} Avail_1)

/

Sum({<Semana={">=$(=Num(Max(Semana))-2)<=$(=Num(Max(Semana)))"}>} Avail_2)

Regards,

- Javier Florian