Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

hybrid_man
New Contributor

Filter with limited value and sum with set expression

Hi, i have a question, is there a better way to resolve this issue.

I have a data with sales by country:

SALESCOUNTRY:

Load *

Inline [COUNTRY, SALES

USA, 5

CANADA, 4

CHINA, 8];

I want to show a filter only with USA and CHINA so i have created a field COUNTRY_USA_CHINA = IF(MATCH(COUNTRY, 'USA','CHINA'),COUNTRY)

I Want to show a KPI showing only sales for USA, so a have created a SUM with SET expressions:

SALES_USA = SUM({<COUNTRY = {'USA'}>} SALES)

The problem is, when i select CHINA from filter COUNTRY_USA_CHINA , sales in field SALES_USA is showing 0. Why? Set expression should disregard the current selection.

Is there a way to resolve this issue without calculating COUNTRY_USA_CHINA is QVD?


SALES_USA.png

1 Solution

Accepted Solutions
MVP
MVP

Re: Filter with limited value and sum with set expression

Create your filter like this

Aggr(Only({<COUNTRY =  {'USA', 'CHINA'}>} COUNTRY), COUNTRY)

4 Replies
MVP
MVP

Re: Filter with limited value and sum with set expression

Create your filter like this

Aggr(Only({<COUNTRY =  {'USA', 'CHINA'}>} COUNTRY), COUNTRY)

agigliotti
Honored Contributor II

Re: Filter with limited value and sum with set expression

you should use as below for usa sales:

SUM( {< COUNTRY_USA_CHINA =, COUNTRY = {'USA'} >} SALES )

hybrid_man
New Contributor

Re: Filter with limited value and sum with set expression

Thanks, but that dosn't work  I think that You can't use calculated measure COUNTRY_USA_CHINA  in expression.

hybrid_man
New Contributor

Re: Filter with limited value and sum with set expression

Thanks, that works fine

Community Browser