Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
TaterTot
Partner - Contributor
Partner - Contributor

If a value is greater than zero: Sum a different field

Hi everyone, new to Qlik and the front end Syntax!

I'm essentially trying to sum my total PLANNED HOURS if TPROG (A different field) is greater than Zero. I initially Num#(TPROG)   in the DLE but went back to making it text because it's different codes. it currently is text - and looks like this

TaterTot_0-1668510211075.png

I don't mind changing it back to Nums but only some of them actually change. This is what I'm doing using set analysis to try to get a bar graph of total planned hours.

Sum({<TPROG ={">0"}>} [Planned Hours])

The above formula was when it was still Nums. It didn't work.

Any help/input would be appreciated

Labels (3)
1 Solution

Accepted Solutions
agigliotti
Partner - Champion
Partner - Champion

To achieve it you should add a new field in DLE as below:

...
...

If( IsNum(TPROG) = -1, 'Y', 'N' ) as isNumeric

then in UI you can use the below expression:

Sum( {< isNumeric = {'Y'} >}  [Planned Hours] )

I hope it can helps.

Best Regards

View solution in original post

4 Replies
agigliotti
Partner - Champion
Partner - Champion

Hi @TaterTot ,

That field is a text (ex. AMBK) so how could you check if it's greater than 0?
To me It does not makes sense.

Best Regards

TaterTot
Partner - Contributor
Partner - Contributor
Author

I'm wondering if possibly I need to also exclude all the texts and only consider the number fields?

 

agigliotti
Partner - Champion
Partner - Champion

To achieve it you should add a new field in DLE as below:

...
...

If( IsNum(TPROG) = -1, 'Y', 'N' ) as isNumeric

then in UI you can use the below expression:

Sum( {< isNumeric = {'Y'} >}  [Planned Hours] )

I hope it can helps.

Best Regards

Or
MVP
MVP

That's how Sum() works in the first place, I believe.

Load * Inline [
Field1
1,
2,
3,
A,
B,
C
];

Or_0-1668513277097.png

 

num#() will return a numeric null for non-numeric values, so you should also be able to use that if you need to.