Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Tarig
Contributor III
Contributor III

how to sum nulls

Hello guys

I am new to qlik, can someone help me to find what is wrong in my expression:

I am trying to sum earnings for certain Categories plus null values. thanks for helping 

=IF(
ISNULL (ContractCategoryGroup), Sum(${<ISNULL (ContractCategoryGroup)>} Round ((Earnings), -5)/1000000),
IF(
ContractCategoryGroup = {'Features', 'Dramatic', 'Commercials'}, Sum({$<ContractCategoryGroup = {'Features', 'Dramatic', 'Commercials'}>} Round ((Earnings), -5)/1000000)
)
)

 

Labels (1)
6 Replies
sunny_talwar
MVP
MVP

The best way would be to create a new flag in the script like this

If(Len(Trim(ContractCategoryGroup)) = 0 or Match(ContractCategoryGroup, 'Features', 'Dramatic', 'Commercials'), 1, 0) as ContractCategoryGroupFlag

and then this

Sum({$<ContractCategoryGroupFlag = {1}>} Round(Earnings, -5)/1000000)

 

Tarig
Contributor III
Contributor III
Author

I am so sorry but where I should create flag?

If(Len(Trim(ContractCategoryGroup)) = 0 or Match(ContractCategoryGroup, 'Features', 'Dramatic', 'Commercials'), 1, 0) as ContractCategoryGroupFlag

sunny_talwar
MVP
MVP

In the script

Tarig
Contributor III
Contributor III
Author

are you saying under measures field

sunny_talwar
MVP
MVP

No my friend, in place where you modify script (back end)

Tarig
Contributor III
Contributor III
Author

thank you for helping me. I don't have script because under data I have sql query