Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Exclusion

Hi,

How can I make a measure conditioned to a selected option in a filter pane?

For instance, my filter option under Department (this is the name of the field) is "CORP", I want the measure to adjust to this filter wheter CORP is selected or not.

It could be something like: if(Department = 'CORP', SUM(Amount1), SUM(Amount2))

I would appreciate your help.

5 Replies
ogster1974
Honored Contributor II

Re: Exclusion

‌for this type of solution I use an extension to set a variable and apply to the measure, dimension etc.. See this link for a example of how I've don'te it in the past.

Makes Sense to go round in circles

Not applicable

Re: Exclusion

What if you used the concat() function to establish the possible values.  It's a stretch but doesn't require building an extension object.

=if(concat(DISTINCT [Department Type], ', ') like '*CORP*', SUM(Amount1), SUM(Amount2))

MVP
MVP

Re: Exclusion

Try this expression

If(SubStringCount('|' & GetFieldSelections(Department , '|', 10000) & '|', '|CORP|'), SUM(Amount1), SUM(Amount2))

OR

If you select only one department always then use below expression

if(Only(Department) = 'CORP', SUM(Amount1), SUM(Amount2))


Hope this helps you.


Regards,

Jagan.

sasikanth
Valued Contributor III

Re: Exclusion

HI,

Try this Expression

Sum(if(Department='CORP',Amount1,Amount2))

reddys310
Honored Contributor II

Re: Exclusion

Hi Cesar,

Your expression will just work fine "if(Department = 'CORP', SUM(Amount1), SUM(Amount2))" if you have a second dimmension added to your visual. This will even work when you have a filter set. So adding a second dimension which has the value CORP will do.

Community Browser