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: 
Not applicable

Set analysis disaster

Hi,

I have what I think is a basic set analysis. I want to sum the value where a certain flag = 1. In my data there is not one flag = 1, but a lot of nulls. The below seems to for some reason be summing up all of the nulls? And giving me a value when there shouldn't be one.

Does anyone know why this would happen or if I'm missing something?

sum({$<flag={'1'}>}value)

Many thanks

4 Replies
Gysbert_Wassenaar

The only thing that springs to mind is that you didn't use the exact field name for your flag field in the set expression. Qlikview is case sensitive so flag is not the same as Flag or flAg or flaG. If the set expression can't be evaluated then you get the sum over all records.


talk is cheap, supply exceeds demand
Not applicable
Author

thanks Gysbert, it is definitely the correct Flag. Will it sum up all records if everything it is trying to evaluate is null?

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi Imush,

I will try and wrap the sum function in IF() funcction. So, IF(flag=1,sum(value),"")

Let us know if it helps.

Regards,

Gabriel

greg-anderson
Luminary Alumni
Luminary Alumni

Hi there.  Try double quotes for text (or numbers) or no quotes (for numbers only).  QV can be picky.

You don't need the curly braces around the match value.  Try this: sum({$< [flag] = {1}>}value)

And make sure "value" means something in your file.