Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
alexis
Partner - Specialist
Partner - Specialist

Convert SET Analysis with a button/action

Hi,

One of my KPIs displays one of 2 values dependent on whether the user has clicked on "Import" or "Export" (see variable vImportsExportsView)

= if ($(vImportsExportsView) = 1,

//IMPORT i.e. Source NOT Cyprus

count({<[Source_Region]-={'Cyprus'}>} AWB)

,

// EXPORT i.e. Source = Export and Destination NOT Cyprus

count({<[Source_Region]={'Cyprus'}, [Destination_Region]-={'Cyprus'}>} AWB)

)

In one of my tabs I want to offer them a button (to switch between Import/Export) and I am not sure what "Actions" I need to define to achieve the above.

With "Export" it's easy because I define "Select in field"

Field = Source_Region

Search String = if ($(vImportsExportsView) = 1, 'Cyprus', '')

Not sure how to handle:

Field = Destination_Region

Search String = ???

which also applies to "Import"

Any ideas or suggestions??

Thanks

Alexis


4 Replies
sunny_talwar

Not sure, but what if you do this via a variable.

Set a variable (named vVar) using the following expression -> If(vVar = 1, 0, 1)

and then use this expression:

If(vVar = 1, count({<[Source_Region]-={'Cyprus'}>} AWB), count({<[Source_Region]={'Cyprus'}, [Destination_Region]-={'Cyprus'}>} AWB))

schlettig
Partner - Creator
Partner - Creator

Hi,

this solution will work.

Just a remark to the toggling of the vVar from 0 to 1.

This Expression is shorter:

$(vVar) BITXOR 1

Also if you have only 0 and 1 you could use instead of:

If(vVar = 1, count  .... )

and

If(vVar, count ...)

You'll save some CPU Cycles.

Best regards,

Christian

alexis
Partner - Specialist
Partner - Specialist
Author

Hi Sunny

Thanks for the reply.

Yes I agree this will work fine - it's just that I want these selections to be shown on the Source/Destination drop down listboxes that are been displayed.

regards

Alexis

sunny_talwar

You can learn about search strings at this place more than any other place: Compound Search - demystified