Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
stjernvd
Partner - Creator
Partner - Creator

Hide values that equal zero in a straight table

Hi,

I have a straight table that has several columns with different expressions.

One of the examples is this expression:

Count({<Month={$(vMonthMinus1)},Year={$(vYearMonthMinus1)}>}Place)

 

I want to have a button that says 'hide zeros', then when I press this button, if

 

Count({<Month={$(vMonthMinus1)},Year={$(vYearMonthMinus1)}>}Place) = 0,

I want to hide all zero values in the column in my straight table and show values >0.

Is this possible?

 

1 Solution

Accepted Solutions
hemhund2016
Creator
Creator

Hi,

1. Create a variable "vHideZero" and set value as -1

2. Create the button "hide zeros" and add action External -> Set variable as below

variable : vHideZero

Value:     = if(vHideZero= -1,0,1)

3.in chart,  your expression should be

if(Count({<TradeMonth={$(vMonthMinus1)},TradeYear={$(vYearMonthMinus1)}>}Destination) >vHideZero,

Count({<TradeMonth={$(vMonthMinus1)},TradeYear={$(vYearMonthMinus1)}>}Destination) )

4. In Presentation tab, Check the "Supress Missing" and uncheck the "Supress Zero values"


Thanks,

hemanth.

View solution in original post

6 Replies
sunny_talwar

May be this:

If(vVar = 0, Count({<TradeMonth={$(vMonthMinus1)},TradeYear={$(vYearMonthMinus1)}>}Destination),

If(Count({<TradeMonth={$(vMonthMinus1)},TradeYear={$(vYearMonthMinus1)}>}Destination) > 0, Count({<TradeMonth={$(vMonthMinus1)},TradeYear={$(vYearMonthMinus1)}>}Destination)))

Where vVar (If(vVar = 1, 0, 1)) will be controlled with the button. When it is 0, everything will be showed, when it is 1, you won't see 0s.

swuehl
MVP
MVP

If you want to hide the lines where

Count({<TradeMonth={$(vMonthMinus1)},TradeYear={$(vYearMonthMinus1)}>}Destination) = 0


you can enable 'suppress zero values' on presentation tab.

This will hide the lines where all expression columns are zero.


So every other expression needs to check your condition, too:

If(  "ExpressionLabelWithZeros" <> 0, OtherExpression, 0)

marcus_sommer

Normally this - result of 0 - would be hide per default (option within the tab presentation) but if you have further expressions which have a value for this row the row remained visible. Then you would need to implement such condition for each expression, like this (generic approach):

if('$(var)' = 'hidden', if(count(value)>0, ExpressionForThisColumn, Null()), ExpressionForThisColumn)

// the value for var will be changed per button

Maybe an alternatively could be to use several objects within a container and the user could switch which view he/she want to see.

- Marcus

hemhund2016
Creator
Creator

Hi,

1. Create a variable "vHideZero" and set value as -1

2. Create the button "hide zeros" and add action External -> Set variable as below

variable : vHideZero

Value:     = if(vHideZero= -1,0,1)

3.in chart,  your expression should be

if(Count({<TradeMonth={$(vMonthMinus1)},TradeYear={$(vYearMonthMinus1)}>}Destination) >vHideZero,

Count({<TradeMonth={$(vMonthMinus1)},TradeYear={$(vYearMonthMinus1)}>}Destination) )

4. In Presentation tab, Check the "Supress Missing" and uncheck the "Supress Zero values"


Thanks,

hemanth.

thakkarrahul01
Creator
Creator

As you are having scenario where there are multiple expressions, enabling suppress zero values option on all expressions will only supress rows when complete row is calculated to zero.

With button you should be able to achieve this using variable as suggested above.


stjernvd
Partner - Creator
Partner - Creator
Author

Thank you so much!