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

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

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

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!