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

How to remove specific values of a field in a sum expression


Hello everyone,

I need to create a bar chart which displays the sum of specific values of a field called "Categoria".

Below is the printscreen of the field in my data base:

categoria.JPG

I don´t want to sum the values "Mulheres" and "Homens", it should be removed from the result of the sum.

Thanks,

12 Replies
Anonymous
Not applicable
Author

You want at dimension level or Expression level?

Chanty4u
MVP
MVP

try dis,

sum( {<Categoris= {'Mulheres','Homens'}>} Categoris )


Anonymous
Not applicable
Author

At dimension level you can try like:

Edit your dimension with:

if(Categoria<>'Mulheres' and Categoria<>'Homens', Categoria)

At Expression level you can do:

sum({<Categoria={'*'}-{'Mulheres','Homens'}>} Field)  //as per your requirement

Chanty4u
MVP
MVP

or else   u can chk below link

https://community.qlik.com/docs/DOC-1334

hope this helps you

Thanks

Suresh

Not applicable
Author


try this

sum( {<Categoris -= {'Mulheres','Homens'}>} Categoris )

Not applicable
Author

Thanks for your help guys.

I forgot to say that i need to divide the result of the sum by the value of "Regular Employee" of each year.

For example, here is the sum from 2014:

Sum.jpg

And than, i need to divide the result of the sum (1295), by the value of "Regular Employee" (897) of the same year:

split.jpg

Thanks


Anonymous
Not applicable
Author

then try this:

=(sum(YourField12)/sum({<YourField={'Regular Employee'}>} YourField12))

Anonymous
Not applicable
Author

In brief after your requirement sharing:

Take this as a Dimension:

if(Categoria<>'Mulheres' and Categoria<>'Homens', Categoria)


and


Expression:  =(sum(Amount)/sum({<Categoria={'Regular Employee'}>} Amount))



Not applicable
Author

Somenthig went wrong, here are the values displayed:

year.jpg

I guess the sum expression is not doing the sum by year.

Note that Year is a dimension of my chart.