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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Correct Syntax for Calculated Dimension with COUNT?

Hi,

I have a column (created as an expression) in a straight table using the following syntax (and it works fine):

Count(DISTINCT {<[Status Type] = {"CON"},[Action Type] = {"INS","UPD"}>}[Partner ID])

I'm trying to replace this column with a calculated dimension column so that I can use a drop-down select in the heading. Can anyone tell me how to rewrite this expression correctly for a calculated dimension? Just copying/pasting is yielding an "Error in calculation" error. From digging around, I get the impression I need to use AGGR, but I've tried a couple different ways to write it, and I can't get it right. Thanks!

-Kenny

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

you can use AGGR function like below and you need to pass your Dimensions in AGGR function.

AGGR( Count(DISTINCT {<[Status Type] = {"CON"},[Action Type] = {"INS","UPD"}>}[Partner ID]) , Dim1 ,Dim2 )

View solution in original post

3 Replies
Not applicable
Author

you can use AGGR function like below and you need to pass your Dimensions in AGGR function.

AGGR( Count(DISTINCT {<[Status Type] = {"CON"},[Action Type] = {"INS","UPD"}>}[Partner ID]) , Dim1 ,Dim2 )

Kushal_Chawda
MVP
MVP

Try

aggr(if(Count(DISTINCT {<[Status Type] = {"CON"},[Action Type] = {"INS","UPD"}>}[Partner ID])>0,Dimesion),Dimesion)

check suppress when value is NULL

Not applicable
Author

Thanks, Dathu. This worked for me. Appreciate the quick responses from everyone!