Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select all values with a button based on expressions

Hi all,

I have a bar chart wherein I have the following dimension:

=aggr(Count(usersubscription.id), profile.id)

and I use the following expression to exclude those profiles that have more than 1 usersubscription:

=if(aggr(count(usersubscription.id), profile.id) > 1, count(distinct usersubscription.id))

Now I want a button that is able to select all values from that bar chart. Is this possible to do this through Actions - > 'Select in Field'?

Thanks in advance!

Byron

1 Solution

Accepted Solutions
Not applicable
Author

I found the answer.

Action > Toggle Select

Field:

profile.id

Search String:

='=if(aggr(count(user_subscription.id), profile.id) > 1, count(distinct user_subscription.id))'

(So my original expression had to be put between quotes with a '=' in front and the '=' had to be removed in the Field box.)

View solution in original post

6 Replies
Nicole-Smith

You would need to use the Actions > Toggle Select to select more than one value at a time.  (For example, if you want to select A and B, your Select String would need to be (A|B)).  So you would need to use something like:

=if(aggr(count(usersubscription.id), profile.id) > 1, '(' & concat(distinct profile.id, '|') & ')')

Not applicable
Author

nicole_kowalsky wrote:

You would need to use the Actions > Toggle Select to select more than one value at a time.  (For example, if you want to select A and B, your Select String would need to be (A|B)).  So you would need to use something like:

=if(aggr(count(usersubscription.id), profile.id) > 1, '(' & concat(distinct profile.id, '|') & ')')

Thanks for the reply, but what I did was Actions > Toggle Select:

Field:

=usersubscription_id

Search String:

=if(aggr(count(usersubscription.id), profile.id) > 1, '(' & concat(distinct profile.id, '|') & ')')

However without succes. Must I not fill in more than 1 fieldname in 'Field', or am I doing some else wrong?

Nicole-Smith

You cannot have a '=' in Field.  You need to just put the field name that you want changed.

Not applicable
Author

I found the answer.

Action > Toggle Select

Field:

profile.id

Search String:

='=if(aggr(count(user_subscription.id), profile.id) > 1, count(distinct user_subscription.id))'

(So my original expression had to be put between quotes with a '=' in front and the '=' had to be removed in the Field box.)

natebrunner
Contributor III
Contributor III

I tried this for something similar and it worked. But I don't really get why? How is it working with that second Count Distinct? If the first part of the "IF" is satisfied, you then are counting Distinct User_Subsription_ID. Don't you need to instead put in a list of user_susbscription_ids? Doesn't your expression place a number into the toggle select?  I'm just a bit confused on how it's actually working.

Anonymous
Not applicable
Author

This will actually show the list of profile.id in the current selections as opposed to showing the expression string. Very useful for display purposes...