Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sqlpuzzle
Contributor III
Contributor III

Expression to Get Count with a condition

AccountIdCountry
1USA
2USA
3USA
4USA
5USA
6USA
7USA
8USA
2CAN
2CAN
3CAN
4CAN
6CAN
6CAN
5USA
9CAN

Hello,

In a sample scenario I have the above table.

AccountId's in both Countries are 2,3,4,6.

I need an expression that would count the distinct AccountId's that exist in both countries.

In this case I am expecting 4 as four of them (2,3,4,6 exists in both countries)

How can I get this done?

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi Joe,

=Count({<AccountId={'=Count(DISTINCT Country) > 1'}>} DISTINCT AccountId)    ->  4

=Concat({<AccountId={'=Count(DISTINCT Country) > 1'}>} DISTINCT AccountId,';')  ->   2;3;4;6

Regards,

Antonio

View solution in original post

1 Reply
antoniotiman
Master III
Master III

Hi Joe,

=Count({<AccountId={'=Count(DISTINCT Country) > 1'}>} DISTINCT AccountId)    ->  4

=Concat({<AccountId={'=Count(DISTINCT Country) > 1'}>} DISTINCT AccountId,';')  ->   2;3;4;6

Regards,

Antonio