Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
MarcoLuna
Contributor
Contributor

Problem with aggr and months selected

Hi, I am trying to get the total value from a table and pass it to a KPI. In the table the expression looks for customers who have bought 3 months ago but who didnt buy in the current month and the previous one. 

The expression is

Sum( Aggr(

if(
sum({$<
Year=,
Month=,
Trimester=,
PeriodNumber = {">= $(=Max(PeriodNumber )-2) <=$(=Max(PeriodNumber ))"}
>}
Sell_Cte_Fil.Sell_Fil_Cte) = 0

AND

sum({$<
Year=,
Month=,
Trimester=,
PeriodNumber = {$(=Max(PeriodNumber )- 3)}

>}
Sell_Cte_Fil.Sell_Fil_Cte) > 1,
1, 0
),Sell_Cte_Fil.Filial, Sell_Cte_Fil.%Key_Client, Sell_Cte_Fil.Client))

When I have it in the straight table it works correctly, but in the kpi it gives me the result in 0, I noticed that when I select the current month (November) and the month of 3 months ago (August) it does give me the correct result. So I think it has to do with the fact that for some reason qlik can't see the previous third month

MarcoLuna_1-1637622729977.png

 

(1 month selected)

MarcoLuna_2-1637622800039.png

(2 months selected)

I appreciate any help you can give me
 
 


 

1 Solution

Accepted Solutions
MarcoLuna
Contributor
Contributor
Author

I was able to solve it I just had to add {1} after the sum to make it ignore the selections

View solution in original post

1 Reply
MarcoLuna
Contributor
Contributor
Author

I was able to solve it I just had to add {1} after the sum to make it ignore the selections