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: 
NathanS2022
Contributor II
Contributor II

Aggr Filter turning into 0

Good afternoon everyone, how are you?

I need some help to understand why one of my mesaures are not working as expected.

I have two measures, the first is used to get the month value

--- sum(aggr(sum(distinct{$<Mes={"$(=month(max(DT_ENT_NFS_ENT)))"}>}VLR_TOTAL_NFS_ENT),ID_NFS_ENT)) ---

and  the second to get the previous month value

--- sum(aggr(sum(distinct{$<Mes {"$(=Month(AddMonths(Max(DT_ENT_NFS_ENT),-1)))"}>}VLR_TOTAL_NFS_ENT),ID_NFS_ENT)) ---

My issue is that when i filter a month, like mar, the month value was correctly filtered, but, the previous month value was turned into 0.

When I do not use filters, the current and previous month are correctly showed.

 

No filter (considering apr and mar):

NathanS2022_1-1681762330372.png

 

Filtered (mar)

NathanS2022_3-1681762404534.png

 

Thank you for the help

Labels (3)
4 Replies
sandeep-singh
Creator II
Creator II

Very small correction. try this

sum(aggr(
sum(distinct {$<Mes = {"$(=Month(AddMonths(Max(DT_ENT_NFS_ENT),-1)))"}>} VLR_TOTAL_NFS_ENT),
ID_NFS_ENT
))

MayilVahanan

Hi

In order to achieve this, we need to ignore the Time filters

sum(aggr(sum(distinct{$<Mes= {"$(=Month(AddMonths(Max(DT_ENT_NFS_ENT),-1)))"}, monthfield=, yearfield=, monthyearfield=, datefield=>}VLR_TOTAL_NFS_ENT),ID_NFS_ENT)) 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
marcus_sommer

Beside the other suggestions be aware that you may need to apply the conditions to each layer of the aggregation, means:

sum({ ... } aggr({ ... } sum({ ... } Field), Dim)) 

NathanS2022
Contributor II
Contributor II
Author

Hi guys, thanks for the replies, but, none of the methods worked here. The kpi remains zero when I filter the months.

My calendar field Mes is like this: "Month([DT_ENT_NFS_ENT]) as Mes"  and I olny using this filed in the filter.