# QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

New Contributor II

## how to use conditional dimension to filter data

Dear all,

I have 4 cities A,B,C,D in the dimension.

 CITY PRODUCTION A 1000 B 2000 C 1000 D 2000

I need to filter on A,B through calculated dimension. How can use the following functions.

1. =

2. <>

3. Like

4. Not Like

Ashok

12 Replies
MVP

## Re: how to use conditional dimension to filter data

What are you doing with filter CITY?

New Contributor II

## Re: how to use conditional dimension to filter data

In the chart i need to show only data for city A, B.  I need to hide C,D

New Contributor II

## Re: how to use conditional dimension to filter data

Can anyone help me out in this

Valued Contributor II

## Re: how to use conditional dimension to filter data

If(City='A' or City='B',City) and Suppress Null is the trivial solution. If you elaborate on what you need, we might be able to suggest a more robust approach.

MVP

## Re: how to use conditional dimension to filter data

Then ,Why can't this?

Sum({<CITY = {'A','B'}>} PRODUCTION)

Honored Contributor

## Re: how to use conditional dimension to filter data

Set analysis as Anil sugest is the best way to filter Dimensions.

Sum({<CITY = {'A','B'}>} PRODUCTION)  gives you A and B

Sum({<CITY -= {'A','B'}>} PRODUCTION) not A and B

Sum({<CITY = {'A*'}>} PRODUCTION) Like, only  A, and wildcard if city like Amsterdam

New Contributor II

## Re: how to use conditional dimension to filter data

I tried but it is still showing all values.

IF(T_SC_NAME = 'COMP' OR T_SC_NAME = 'TP', T_SC_NAME)

in the above statement T_SC_NAME is my Dimension. I need to show values COMP, TP and eliminate TENANTS, WWP. Check the screenshot for better understanding

Valued Contributor II

## Re: how to use conditional dimension to filter data

You can't use Conditional Display to filter data. It's as simple as that. You have to filter through a calculated dimension or through the expression (the latter is recommended).

New Contributor II

## Re: how to use conditional dimension to filter data

Dear Staffan,

The statement is working. But the problem is I am using a variable which has a complex formula to calculate the value and because of that system giving an error allocated memory exceeded. Is there a way to have a condition only based on dimension and inputing the expression in the statement.

For e.g this is my statement in the ENABLE CONTIONAL

SUM({<T_SC_NAME = {'COMP','TP'}>}\$(vCountYTD))

Formula in VARIABLE vCountYTD

(Count(DISTINCT{<T_PREM_TYPE={'N','R'}>}if(T_APPR_DT <= AddYears(max(TOTAL T_APPR_DT), T_YEAR - year(max(TOTAL T_APPR_DT))), T_POL_NO))-Count({<T_PREM_TYPE={'C'}>}if(T_APPR_DT <= AddYears(max(TOTAL T_APPR_DT), T_YEAR - year(max(TOTAL T_APPR_DT))), T_POL_NO)))