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: 
usr1
Contributor II
Contributor II

sum values where another value is null and ignore filters

Hi All,

I have a table that looks like this: 

ID Record ID Document Year ID Amount
A 1 2022 $10
B 2 2022 $10
C - 2022

$10

D 4 2022

$10

 

I would like to sum the ID Amount where the Record ID is equal to " - " (or null) and ignore the document year filter. 

I have tried using: 

=sum({<[Record ID]-= {'*'}, [Document Year]=,>}[ID Amount])

 

But that did not work. 

I have also read through the importance of nothing blog post  but did not find anything to lead me in the right direction. 

Any help you can provide would be great! Thanks! 

Labels (2)
3 Replies
vchuprina
Specialist
Specialist

Hi,

Try the following expression, you will see a syntax error, but it works as expected

sum({-<[Record ID]-= {'*', '-'}, [Document Year]=>}[ID Amount])

In my example Record ID for ID C is - and for E and F are null

vchuprina_0-1651479696495.png

 

Regards,

Vitalii

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
usr1
Contributor II
Contributor II
Author

Unfortunately that did not work. I should clarify the data comes from different tables. 

 

usr1_0-1651495392516.png

 

vchuprina
Specialist
Specialist

Hi,

It should work even if you data in different tables

sum({-<[Record ID]-= {'*', '-'}, [Document Year]=>}[ID Amount])

My data model:

vchuprina_0-1651497147401.png

vchuprina_1-1651497171276.png

Could you please try the following expression sum([ID Amount])? 

Does it show the sum of the ID Amount? If not, you should transform ID Amount to a number, because maybe qlik doesn't recognize your value as a number

Num(PurgeChar([ID Amount], '$')) AS [ID Amount]

Regards,

Vitalii

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").