Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Example between Aggr Distinct/Nodistinct

Time for the stupid question of the day.  It's been a while since I worked with AGGR, and the help is not very helpful in telling me the difference between distinct and nodistinct.  I know it has to do with processing mutlple records, and that it can have different outcomes, but I can't seem to set up a good example to see this.

It's a simple aggr I'm setting up in a straight table chart:  aggr (MAX( {<NPCDate={">=$(vPeriodStart)<=$(vPeriodEnd)"}>} NPCDate), PatientID)

Can you tell me what possible difference in outcome there would be between that and this?:  aggr (NODISTINCT MAX( {<NPCDate={">=$(vPeriodStart)<=$(vPeriodEnd)"}>} NPCDate), PatientID)

Thank you.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

The question is not stupid, I think the question if aggr() should be used with NODISTINCT or DISTINCT is one of the most repeated issues here in the forum. (Does anyone else find it strange that we need to explicitely state a NODISTINCT qualifier on aggr() while we need to state an explicite DISTINCT on count?)

Well, to your question:

I can't tell if you will see a difference, it depends on your data. So have look at

http://community.qlik.com/message/166081

There are multiple occurences of Perfil, but you only get the correct value for one occurence (without using NODISTINCT).

Hope this helps,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

The question is not stupid, I think the question if aggr() should be used with NODISTINCT or DISTINCT is one of the most repeated issues here in the forum. (Does anyone else find it strange that we need to explicitely state a NODISTINCT qualifier on aggr() while we need to state an explicite DISTINCT on count?)

Well, to your question:

I can't tell if you will see a difference, it depends on your data. So have look at

http://community.qlik.com/message/166081

There are multiple occurences of Perfil, but you only get the correct value for one occurence (without using NODISTINCT).

Hope this helps,

Stefan

Not applicable
Author

I had seen that discussion but wasn't sure I understood it.  In my case, PatientID is unique as rows in the table.  So using aggr without the NODISTINCT in my case should work perfectly.

And yes - it kills me that everything else requires a specific DISTINCT and aggr is the only one that works differently.

Thanks.