Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
alexandergrando
Contributor III
Contributor III

Wrong Aggregations in Set Analysis

Hello,

I am trying to SUM units belonging to a property using set analysis. I tried using this expression but it is only showing the result on a single field value with the total being correct:

=SUM({<NPBegDateOfOperation ={"<$(=Date(vNPrintingDate, 'M/D/YYYY')) >=$(=Date(AddMonths(vNPrintingDate, -1), 'M/D/YYYY'))"}>} aggr(NPTotalUnitCount, NPPropertyKey))

Here is the screenshot of the incorrect expression results:

Can someone help me understand what is going on or how to fix this, please?

4 Replies
swuehl
MVP
MVP

Maybe a grain mismatch of your advanced aggregation dimension and your outer chart dimension?

Pitfalls of the Aggr function

Hard to tell with the very few context information provided.

alexandergrando
Contributor III
Contributor III
Author

Hi Stefan,

Thanks for the reply. I'll give the article a careful read. The funny thing is that I get correct results when I use a slightly different expression (changed fields are in bold):

=SUM({<NPBegDateOfOperation ={"<$(=Date(vNPrintingDate, 'M/D/YYYY'))"}, NPEndDateOfOperation ={">=$(=Date(vNPrintingDate-1, 'M/D/YYYY'))"}>} aggr(NPTotalUnitCount, NPPropertyKey))


This leads me to believe that there is another way to write the incorrect expression so that it produces correct results. So that is what I am basically looking for.

vinieme12
Champion III
Champion III

Please post a sample app , can't help much  without looking at the app

Preparing examples for Upload - Reduction and Data Scrambling

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
alexandergrando
Contributor III
Contributor III
Author

Thank you both for your answers. While trying to scramble my fields, I noticed that one of the columns was not scrambling. I suddenly realized that I was using duplicate columns with a different name from another table. That is why the numbers were acting funny.