Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis for field not null and not 0?

Hi community,

How would I make an if statement for not null and not 0?  Here's what I'm trying now:

if(full_value<>0 and 'full_value<>'',full_value)

Regards,

Brandon

1 Solution

Accepted Solutions
Not applicable
Author

Hi Brandon,

You can write if statement like the below way

if

(

your dimension <>0

and

isnull(your dimension) =0,

statement1,

statement2

)

and for set analysis:

sum({<your_dimension-=0,isnull(your_dimension)=0>}expression/dimension).

hope this helps.

thank you

Meher

View solution in original post

5 Replies
Not applicable
Author

Hi Brandon,

You can write if statement like the below way

if

(

your dimension <>0

and

isnull(your dimension) =0,

statement1,

statement2

)

and for set analysis:

sum({<your_dimension-=0,isnull(your_dimension)=0>}expression/dimension).

hope this helps.

thank you

Meher

Not applicable
Author

Hi

You can check the null like below:

if(full_value<>0 and isnull(full_value)=0,full_value)

Btw, if it is a numeric field then the following may also do the work:

if(full_value>0,full_value)

Best regards,

http://quickdevtips.blogspot.com/

Not applicable
Author

the set analysis not zero -=0 isn't working for me.  I remember something like this in the past. 

I copied and pasted your code into my document, but it still give s me the big minus sign rather than the little dash. 

Is that the problem you think and how would I make the little dash with my keyboard?

Not applicable
Author

You know why?  Its because I needed not equal to in an if statement within the set analysis.  Here I can use <>.

My example:

sum({ $<  QBbalcode={'DIRMATL'},

//QB33={'2001'},

//LinkYear={$(=Only("CurrentDocumentYear"))},

//LinkMonth=CurrentDocumentMonth3,

[code3]={'RBIACCT'}

             >}full_value)

             /

            ( count({ $<  QBbalcode={'DIRMATL'},

//QB33={'2001'},

//LinkYear={$(=Only("CurrentDocumentYear"))},

//LinkMonth=CurrentDocumentMonth3,

[code3]={'RBIACCT'}

             >}if(full_value<>0,full_value))

             /

             count({ $<  QBbalcode={'DIRMATL'},

//QB33={'2001'},

//LinkYear={$(=Only("CurrentDocumentYear"))},

//LinkMonth=CurrentDocumentMonth3,

[code3]={'RBIACCT'}

             >}distinct(if(full_value<>0,full_value)))

             )

Not applicable
Author

I just started thinking about the solution for ur question.

If it's working then it's great. thanks for saving my time.

If possible can you mark the question as answered so that it helps others to save time.

let me know if you got any issues in this case.

thank you

Meher