Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello I am new to the Qlikview. I have a button in Qlikview, I want to show the total headcount. I used the following formula in Text Object Properties:
=sum({1} if(([Department]='A' or [Department]='B' or [Department]='C' or [Department]='D'), [Headcount])).
This formula only return sum of departments A and B. It did not include headcounts of department C and D. Can anyone let meknow what is the problem with my formula?
Thank you.
I can't see anything wrong with your syntax. Have you checked that
=sum({1} if([Department]='D', [Headcount]))
=sum({1} if([Department]='D', [Headcount]))
return correct results?
I assume that your departments are not called A,B,C,D so please check the correct spelling / case between your literals in your if() statement and your Department field values.
Could you post some sample data / qvw file?
Regards,
Stefan
I can't see anything wrong with your syntax. Have you checked that
=sum({1} if([Department]='D', [Headcount]))
=sum({1} if([Department]='D', [Headcount]))
return correct results?
I assume that your departments are not called A,B,C,D so please check the correct spelling / case between your literals in your if() statement and your Department field values.
Could you post some sample data / qvw file?
Regards,
Stefan
hi still,
I hope Iunderstand you, why do not you use:
=count({1<Department={'A','B','C','D'}>} Headcount)
Hello, Stefan,
Thank you for your reply. I figured it out. I am working on an exiting Qlikview report and try to find out why the numbers do not match with the original dataset. Following your instruction, i went to check the department names, and they are all correct. But when I was checking the spellings, I found out that the field name was wrong. In the original data set, it has department and subdepartment, somehow, the formula were written as Department='A' or Department='B' or Subdepartment='c' etc.
Now I have corrected and got the correct answer.
Thank you very much.
Hi, Montero,
Thanks for your reply. Here, I could not use count because some person has 0.5 haedcount in one department and 0.5 in another.
Great discussion guys- I'm moving this over to the development area so you can get more visibility. @stillwater-thanks for marking as helpful and answered as it helps the other members receive points for assisting you.