Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
My colleague has a problem with which I could not help him. Suppose we have a table:
user_id | country | atr1 | atr2 |
1 | RU | 1 | 66 |
2 | US | 1 | 55 |
3 | RU | 1 | 55 |
3 | RU | 2 | 77 |
2 | US | 2 | 88 |
He want to count how many times user_id occurs in table (name it "#frequency"), and after that use the result of it and use like dimention and calculate how many user_id occurs in what #frequency.
Result must be somting like this:
#frequency | #users |
1 | 1 |
2 | 2 |
The problem is: if we select atr1 = 1, the result will be like
#frequency | #users |
1 | 3 |
So, i cant calculate it in script, because dimention #frequency will change when in choose something.
Maybe I don't see simple solution?
@lord_zeus if you select atr1 = 1 normaly what is the expected output ?
for me 3 is correct !
in dimension :
=aggr(count(user_id),user_id)
Expression:
=count(distinct user_id)
output:
hi
short one ,
for dimension use this
class(aggr(count(user_id),user_id),1)
expression:
count(distinct user_id)
@lord_zeus if you select atr1 = 1 normaly what is the expected output ?
for me 3 is correct !
in dimension :
=aggr(count(user_id),user_id)
Expression:
=count(distinct user_id)
output:
Guys, thanks! Both answers are correct, but for my task, Taoufiq_Zarra will give the most correct answear.