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

Previous Year Problem

Hi,

i attached a file. Here you can see Chart 1 and Chart 2. In Chart 1 i have the correct result for Current Year and Previous Year (values for 2013 are the same for 2014 plus a zero). In chart 2 when i add the same set analysis present in Chart 1({$<Data = {$(=Only(Data)-1)}>}) i've a bad result for the Previous year...

Thx

3 Replies
Gysbert_Wassenaar

Add the set modifier to the inner aggregation function too.

=sum({$<Data = {$(=Only(Data)-1)}>} if(aggr(nodistinct count({$<Data = {$(=Only(Data)-1)}>}distinct if(isnull(CANC_Ar) AND isnull(CANC_Tr),$(=GetFieldSelections(_VariabileProdotto)))),NumScontrino)>=GetPossibleCount($(=GetFieldSelections(_VariabileProdotto))), TotRigaScontrino))


talk is cheap, supply exceeds demand
Not applicable
Author

Great! Thx a lot. When we use aggr it's a rule? We have to add the set analysis to the inner aggregation function too?

Gysbert_Wassenaar

Usually yes. It depends on what you're trying to calculate.


talk is cheap, supply exceeds demand