Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vinicius_siquei
Partner - Contributor III
Partner - Contributor III

Set Analysis - Consider Selection

Folks,

I have the following set analysis expression on my Dashboard:

= 'Caixa Inicial: ' &  Money(Sum({1<Tipo={'Caixa'},DateID={"<$(=vInicioPeriodo)"}>}[Valor Debito]))

This brings me the right value and by using the variable vInicioPeriodo I can do the calculations considering the dimension Month. If no month is selected, vInicioPeriodo = today, if the user select a month on filter vInicioPeriodo = last day of selected month.

This is working pretty well.

I want to do now is to consider my Company dimension. I mean, by default the expression must consider the values from all companies. If the user select one or more companies on the application filter, my expression must consider only values from these companies.

Any idea of how to do that ?

Thanks!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Check the result of the expression in the dollar sign expansion in a textbox:

=GetFieldSelections(Company)

There are some additional arguments for GetFieldSelections functions, e.g. when coping with a lot of Companies.

It's quite hard to tell what's going wrong without knowing much about your data and setting, so it is in general very helpful if you could post a small sample app.

And please add to any sample your requested results when performing some user actions, there are subtle differences in expressions to handle when e.g. asking for results when user explicitely selects values in Company field vs. possible values in Company field.

I've attached a small sample that might show you how you can use GetFieldSelections and GetSelectedCount when requiring an active selection in a field.

View solution in original post

4 Replies
swuehl
MVP
MVP

Maybe like this:

= 'Caixa Inicial: ' &  Money(Sum({1<Company = {$(=GetFieldSelections(Company))}, Tipo={'Caixa'},DateID={"<$(=vInicioPeriodo)"}>}[Valor Debito]))

vinicius_siquei
Partner - Contributor III
Partner - Contributor III
Author

Getting this error:

Error: Error in set modifier ad hoc element list: ',' or ')' expected

swuehl
MVP
MVP

Check the result of the expression in the dollar sign expansion in a textbox:

=GetFieldSelections(Company)

There are some additional arguments for GetFieldSelections functions, e.g. when coping with a lot of Companies.

It's quite hard to tell what's going wrong without knowing much about your data and setting, so it is in general very helpful if you could post a small sample app.

And please add to any sample your requested results when performing some user actions, there are subtle differences in expressions to handle when e.g. asking for results when user explicitely selects values in Company field vs. possible values in Company field.

I've attached a small sample that might show you how you can use GetFieldSelections and GetSelectedCount when requiring an active selection in a field.

vinicius_siquei
Partner - Contributor III
Partner - Contributor III
Author

Just solved it by using the following expression:

Money(sum({1<Tipo={'Caixa'}, DateID={"<$(=vInicioPeriodo)"}, Filial = {'$(=GetFieldSelections(Filial))'}>} [Valor Debito]))

Thanks swuehl! You gave me the clue!