Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have an case statement(working) in sql server. I have to write the same in qlik view. So, I used if statement for that, but it says there is an error.
It does not give the exact error, is there a way to debug this ??
case when isnull(count(y), 0) > 0 then sum(x)/count(y) else 0 end
For this the if statement i am using is
if ( isnull(count(y),0) > 0 , sum(x)/count(y) , 0)
Try the following expression instead:
If( IsNull(Count(y)) or Count(y)=0, 0, Sum(x)/Count(y)) as your-field-name
Yeah looks like it works with both.
Can you please explain, what was wrong with my code(other than the isnull syntax), and how is your code different from mine.
Why does it not work for positive condition?
IsNull(expr) Qlikview function Returns -1 (true) if expr is NULL, otherwise 0 (false).
So it is never >0
Hope this answers your question.
Yes sir, it does.
Thank you.