Expand my Community achievements bar.

SOLVED

Union activity count differs

Avatar

Level 6

Hi there, 

 

I have two query activities with targeting dimension & filtering dimensions as the recipient
and in my queries the query data is linked to different schemas that output feature name associated to a particular model

one query generated 394 count
another query 191

i am trying to combine the results by using the union.
When I use keys only it give 566

when I use all shared columns it's giving 580.

Does that means there are duplicates?
please suggest how to pass the entire data

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @rvnth ,

It is possible in few scenario. Means that few recipients from Query1 meets the same requirement of Query2 as well.

Example, In Query1 if you fetch all Gender equals to Male and in Query2 fetch all recipients age greater than 30, though both filtering conditions are different, few recipients will be part of both Queries. 

If you want to analyze the common records, use intersection activity and select 'keys only' and enable 'generate complement'. you will be getting 19 records in Result transition as per the above example. 

ParthaSarathy_0-1704818662574.png

And analyze the Result transition and figure it out why those records are part of your both Queries.

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @rvnth ,

Query1 394 and Query2 191, so there are 585 records in total.

When using 'keys only' you got 566 records, because 19 records are common in both queries set.

 

In order to get all 585 total records as output of Union, try the below steps,

In Query1 > add data > add an output column with alias as @dummy and 'A' as expression.

ParthaSarathy_0-1704798881949.png

In Query2 > add data > add an output column with same alias as @dummy and 'B' as expression.

ParthaSarathy_1-1704798917373.png

 

In Union, Select 'All shared columns' and set any of the query as Primary set.

Now you will be getting all the records as output.

Avatar

Level 6

Thank you @ParthaSarathy 

 

Query1 394 and Query2 191, so there are 585 records in total.

When using 'keys only' you got 566 records, because 19 records are common in both queries set.

 

The query filters are different for both query 1 & query 2. So I was wondering how come the values are common in both the queries

Avatar

Correct answer by
Community Advisor

Hi @rvnth ,

It is possible in few scenario. Means that few recipients from Query1 meets the same requirement of Query2 as well.

Example, In Query1 if you fetch all Gender equals to Male and in Query2 fetch all recipients age greater than 30, though both filtering conditions are different, few recipients will be part of both Queries. 

If you want to analyze the common records, use intersection activity and select 'keys only' and enable 'generate complement'. you will be getting 19 records in Result transition as per the above example. 

ParthaSarathy_0-1704818662574.png

And analyze the Result transition and figure it out why those records are part of your both Queries.