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: 
Anonymous
Not applicable

Aggregate Rows with logical question

Hello. See my source table:

 

ProductUSUKCanada
XTRUEFALSETRUE
XFALSETRUETRUE
YFALSEFALSETRUE
ZFALSETRUEFALSE
YFALSEFALSEFALSE
XFALSETRUEFALSE

 

As you can see I have multiple rows for same product. Im trying to aggregate rows based on Product and the logic should be IF there is at least one row where Product/Country = TRUE then in aggregated result it is always TRUE, otherwise FALSE. I can see components like tAggregateRow where I can use some operations like sum, max, etc but I cant specify some logical question like I described.

So in the end Id like to have output table as follows:

 

ProductUSUKCanada
XTRUETRUETRUE
YFALSEFALSETRUE
ZFALSETRUEFALSE

 

Can anyone help? Thank you very much

Labels (2)
4 Replies
cmendels
Contributor III
Contributor III

I created a simple job based on your sample table, using the "max" function of tAggregateRow and got the results you wanted.

0683p000009M97D.jpg0683p000009M8xY.jpg0683p000009M8gr.jpg

Anonymous
Not applicable
Author

How? I have tried that before but Im getting warning below:

The operation 'max' for the output column 'Canada' can't be processed because of incompatible input and/or output types (for each country)

From which I understood aggregate operations cant be ran on boolean or string

cmendels
Contributor III
Contributor III

I have mine set up as string datatype for both input and output and it's working.

 

I am not sure how it would handle boolean, or if that is possible.

Anonymous
Not applicable
Author

@cmendels, no function is available for boolean type, you get the right workaround, just convert the data from string to boolean type after aggregation if needed.