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

Aggr Question

Hi all,

I am still trying to wrap my head around the Aggr() function, so I need some help! I want to group a set of data by ID, and then know how many distinct string values are attributed to that ID. Once I know  that there is more than one unique string, I'd like to display the ID as a dimension. That said, I have this as my dimension expression:

=if(aggr(Count(DISTINCT UniqueString), ID) > 1, ID, Null())

This is returning all Null values. Please help me resove the issue.

Thanks,

Paul

1 Solution

Accepted Solutions
prodanov
Partner - Creator
Partner - Creator

You  must have an expression! enter a expression sum(1) and return

View solution in original post

5 Replies
prodanov
Partner - Creator
Partner - Creator

Hi,

  Whar is your expression? It may give a zero or null.

Regards

Not applicable
Author

My expression is in the dimension field (custom dimension expression).

prodanov
Partner - Creator
Partner - Creator

You  must have an expression! enter a expression sum(1) and return

calvindk
Creator III
Creator III

Try adding both dimension

ID,

and calculated dimension

=if(Count(DISTINCT UniqueString) > 1, ID, Null())

and then do Suppress if NULL on calculated dimension

go to presentation tab

and hide ID

Not applicable
Author

Ahh sorry, I misunderstood your question. I DO have an expression - it's to choose the FirstSortedValue() of unique string based on a date. I double checked my expression and I had reversed the order of the parameters in FirstSortedValue() - I had date first and then UniqueString.  *FACEPALM*

I corrected the expression and VOILA. This was a simple/stupid error - thanks for the suggestion and for keeping me sane!

-Paul