Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
thanks Gysbert, it is definitely the correct Flag. Will it sum up all records if everything it is trying to evaluate is null?
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
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.