Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

balrajahlawat
Esteemed Contributor

Restrict Dimension with '0' value in qliksense

Hey Guys,

I am having a Dimension with multiple expression in qliksense..

How can I restrict those dimensions where expression value is '0'??

I don't want using properties like Add-on - > Data Handling - > Uncheck 'Include Zero Values'....

I want at dimension or expression level itself..

Pls suggest.

Regards,

BA

8 Replies
karthikoffi27se
Contributor III

Re: Restrict Dimension with '0' value in qliksense

Hi Balraj

Try using if condition.

IF("yourExpression"=0,null(),"YourExpression")

Hide null values.

Many Thanks

Karthik

balrajahlawat
Esteemed Contributor

Re: Restrict Dimension with '0' value in qliksense

any other options possible as I am multiple if condition at expression level....can we do it at Dimension level?

ogster1974
Honored Contributor II

Re: Restrict Dimension with '0' value in qliksense

Is it possible during data load to set a flag on the dimension either in the script or data transformation stage.. That will simplify the calculated dimension suggested by karthik

omarbensalem
Esteemed Contributor

Re: Restrict Dimension with '0' value in qliksense

You can do this in the script level or create a master dimension:

=aggr(if(sum(YourMeasure)=0,Null(),YourDim),YourDim)


And use this newly crated dimension in ur chart

balrajahlawat
Esteemed Contributor

Re: Restrict Dimension with '0' value in qliksense

Omar,

I already tried this...but in my case I am having 4-5 different measures for 4-5 expressions...

How to use those 4-5 measures to create a master dimension??

alip_nath
Contributor

Re: Restrict Dimension with '0' value in qliksense

slightly unrelated however, can you elaborate what does this function do - list down dimensional values for non-zero values of the measure involved i.e a non-zero master dim?

=aggr(if(sum(YourMeasure)=0,Null(),YourDim),YourDim)

Highlighted
omarbensalem
Esteemed Contributor

Re: Restrict Dimension with '0' value in qliksense

u want to hide all dimensions where all the 5 measures are 0?

omarbensalem
Esteemed Contributor

Re: Restrict Dimension with '0' value in qliksense

To translate it in human words:

a dimension is a list of values; and we want to show only values where there is sum of YourMeasure >0

so

if YourMeasure =0 in the dimension value,do not show it (null()) else, show the values where there is a measure:

to break it:

this is the condtion!

if(sum(YouMeasure)=0,null(),YourDimension)

Note: since, by default, Qlik won't show null() values in a filter box, all of these newly created null() values won't be shown in our master dimension.

But till now, we want to create a dimension; and we're using a measure (sum(YourMeasure) without aggregating it to the dimension it self; in fact, we want to see this condition on the YourDimension level.

so we waggregate with the concerned dimension:

=> final dim will be :

=aggr(if(sum(YourMeasure)=0,Null(),YourDim),YourDim)

or

=if(aggr(sum(YourMeasure),YourDim)=0,Null(),YourDim)