Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ecacarva
Contributor II
Contributor II

Show zero in table

I have a table with Year, Quantity of Employees, Accum Quantity (no dept is selected)

Captura de tela de 2020-09-21 10-31-23.png

When I select some  department it hides zero values

Captura de tela de 2020-09-21 10-33-45.png

I selected to include zeros in Complement.

Somebody would help?

Labels (2)
2 Solutions

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @ecacarva 

What you are seeing here is not that there is a zero value when the Department is selected, rather there is no association in the data.

The way to deal with this is to ignore the selection, which you can do with set analysis.

Assuming your expression is currently:

sum([Qtde Servidor])

You could add on the end of this the value with selections ignored, multiplied by zero (so it doesn't alter the result):

sum([Qtde Servidor]) + sum({1}[Qtde Servidor]*0)

The {1} in set analysis means ignore all selections and give the value for the whole set.

This will, however, mean that if you select a range of years it will still show all years in the table. This can be resolved using the P() function:

sum([Qtde Servidor]) + sum({1<Ano2=P({$}Ano2)>}[Qtde Servidor]*0)

Alternatively, if it was only the Department selection you wanted to ignore, whilst still respecting all other selections you can do this:

sum([Qtde Servidor]) + sum({<Department=>}[Qtde Servidor]*0)

There is plenty written on-line about set analysis, and why the expressions above do what they do. A quick Google should turn up some explanations.

Hope that helps,

Steve

View solution in original post

ecacarva
Contributor II
Contributor II
Author

Thank you @stevedark, it works perfectly with some adaptations !!!

RangeSum(Above(Count(distinct[MATRÍCULA]),0,RowNo())) + sum({1<[%Ano2]=P({$}[%ANO_ADMISSAO])>}[MATRÍCULA]*0)

View solution in original post

2 Replies
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @ecacarva 

What you are seeing here is not that there is a zero value when the Department is selected, rather there is no association in the data.

The way to deal with this is to ignore the selection, which you can do with set analysis.

Assuming your expression is currently:

sum([Qtde Servidor])

You could add on the end of this the value with selections ignored, multiplied by zero (so it doesn't alter the result):

sum([Qtde Servidor]) + sum({1}[Qtde Servidor]*0)

The {1} in set analysis means ignore all selections and give the value for the whole set.

This will, however, mean that if you select a range of years it will still show all years in the table. This can be resolved using the P() function:

sum([Qtde Servidor]) + sum({1<Ano2=P({$}Ano2)>}[Qtde Servidor]*0)

Alternatively, if it was only the Department selection you wanted to ignore, whilst still respecting all other selections you can do this:

sum([Qtde Servidor]) + sum({<Department=>}[Qtde Servidor]*0)

There is plenty written on-line about set analysis, and why the expressions above do what they do. A quick Google should turn up some explanations.

Hope that helps,

Steve

ecacarva
Contributor II
Contributor II
Author

Thank you @stevedark, it works perfectly with some adaptations !!!

RangeSum(Above(Count(distinct[MATRÍCULA]),0,RowNo())) + sum({1<[%Ano2]=P({$}[%ANO_ADMISSAO])>}[MATRÍCULA]*0)