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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
rickrogers
Contributor II
Contributor II

Expression not summing correctly

Line 2 and Line 5 are preventing this expression from summing correctly, can you help me modify the syntax on those lines?

=Sum({$<[Metal] ={'Li','Na' },                                                      // Line 1                   

[State]-={'Liquid'}                                                                           // Line 2

,Elements=E({1<[Elements] = {'H'}>})>                                  // Line 3

+1<[Metal]={'Mg'},                                                                          // Line 4

[State]-={'Liquid'}                                                                           // Line 5

,Elements=E({1<[Elements] = {'H'}>})>                                  // Line 6

}Quantities))                                                                                     // Line 7

1 Solution

Accepted Solutions
Saravanan_Desingh

Forgot to tell you the other option. You can try like this.

=Sum({$<[Metal] ={'Li','Na' },                            // Line 1                   
[State]-={'Liquid'}                                       // Line 2
,Quantities=E({1<[Elements] = {'H'}>})>                     // Line 3
+1<[Metal]={'Mg'},                                        // Line 4
[State]-={'Liquid'}                                       // Line 5
,Quantities=E({1<[Elements] = {'H'}>})>                     // Line 6
}Quantities))                                             // Line 7

View solution in original post

2 Replies
Saravanan_Desingh

Forgot to tell you the other option. You can try like this.

=Sum({$<[Metal] ={'Li','Na' },                            // Line 1                   
[State]-={'Liquid'}                                       // Line 2
,Quantities=E({1<[Elements] = {'H'}>})>                     // Line 3
+1<[Metal]={'Mg'},                                        // Line 4
[State]-={'Liquid'}                                       // Line 5
,Quantities=E({1<[Elements] = {'H'}>})>                     // Line 6
}Quantities))                                             // Line 7
Saravanan_Desingh

If this is still not working, please post some sample data and expected output.

 

Note: If you use -=, it will remove NULL values also.