Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I'm in trouble using a variable on my designe.
I built a pivot table and I have to insert my expression.
the expression is:
if( $(vUtPe) >= 0
,
$(vUtPe)
,
0
)
where $(vUtPe) is:
sum({ $<D_LIV1={BITI},D_LIV2={ATTIVO},Partite.Anno={ 2012}> } Partite.WRBTR)
+
sum({ $<D_LIV1={BITI},D_LIV2={PASSIVO},Partite.Anno={ 2012}> } Partite.WRBTR)
unfortunately it doesn't show me the result. I mean the test say OK is >0 but I don't have the result on my row. To be clearer it doesn't show me that records.
If I write:
if( $(vUtPe) >= 0
,
'OK >0'
,
0
)
it works. I have the row with " Ok > 0 ".
I don't understand what is going on.
The if test is working but when i try to put the variable as result it doesn't work.
Any help will be appreciated
thanks in advance
Giampiero
Hi,
try to add equal sign in expression of variable $(vUtPe)
=sum({ $<D_LIV1={BITI},D_LIV2={ATTIVO},Partite.Anno={ 2012}> } Partite.WRBTR)
+
sum({ $<D_LIV1={BITI},D_LIV2={PASSIVO},Partite.Anno={ 2012}> } Partite.WRBTR)
Regards
MC
Hi Mario,
thanks for your reply.
I tried, but it doesn't work.
Thank you
Giampiero
Hi,
i dnt understand from where OK comes into the if expression in place of the variables ?
Could u explain?
Regards
Maybe try experimenting without the dollar sign expansion, or by putting the variable in single quotes.
Hi,
what I want to say is. The test of the if is working. So
if( $(vUtPe) >= 0
,
Test works fine. So it goes on and i can put my var here. unfortunately whene i put $(vUtPe) here, it doesn't work. But if I put a string like "I TEST POSITIVE" it works.
,
0
)
hope it helps.
THANKS A LOT for your reply
Hi,
I tried both solutions.
Unfortunately they don't work.
Many thanks
Hi!
First I would try writing your expression like this:
if( $(vUtPe) >= 0
,
$(=vUtPe)
,
0
)
There is that extra equal-sign.
Then I would try creating textbox with expression =$(=vUtPe)and see what it gives.
Then I would replace vUtPe in original expression with new variable (lets say LET A = '1';)
Last I would place that original variable vUtPe to table as an expression, without label, and check how dollar sign expansion is working.
In this point you know where the problem is and you can solve it.
BR,
Miikka
Hi Miikka,
Thanks for your reply.
I tried but it doesn't work.
Fortunately , i understood why it doesn't show the variable.
It's my fault because I ever have to think about how Qlik works.
I wanted to put a general result on a row so in a particular result.
obviously it was a mistake.
So it was sufficient to write my var with tis expression:
sum( TOTAL { $<D_LIV1={BITI},D_LIV2={ATTIVO},Partite.Anno={ 2012}> } Partite.WRBTR)
+
sum( TOTAL { $<D_LIV1={BITI},D_LIV2={PASSIVO},Partite.Anno={ 2012}> } Partite.WRBTR)
adding "TOTAL" in my expression I resolved my problem.
THANK YOU so much to everybody.
This community is fantastic for all of us.
Bye
Giampiero
Hi
Rather than using an If statement here, which requires the expression to be evaluated twice, I would suggest using RangeMax, like this:
= RangeMax(0, ($(vUtPe)))
That should return the expression variable value if it is greater than 0, or 0 if less than zero.
Hope that helps
Jonathan