Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys / QlikCommunity:
I have this Expression:-
=sum(if(transdate<CurrentDate -2,Qty))
And also this Expression:-
sum (if (invtype='20',goodqty)) - sum (if (invtype='34',goodqty))
+
sum (if (invtype='40',goodqty)) - sum (if (invtype='42',goodqty))
I need to combine both Expressions into one Expression.
I am not able to use Set Analysis for my Expression.
Could someone enlighten me how to do it?
Thanks a lot guys…
hei
can you explain a little bit more what you mean by combine the expression
what the resault you are after?
Sorry guys:
Forget to add this:-
The Qty in the first Expression is equal to the second Expression which is
sum (if (invtype='20',goodqty)) - sum (if (invtype='34',goodqty))
+
sum (if (invtype='40',goodqty)) - sum (if (invtype='42',goodqty))
I need to combine both the Expression.
Thanks Guys
How about:
sum(if(transdate<CurrentDate -2,
if (invtype='20',goodqty) - if (invtype='34',goodqty)
+
if (invtype='40',goodqty) - if (invtype='42',goodqty))
))
ok
lets give it a try
the first one is assuming currentDate is Varaible with the same value to all data
sum ({<invtype={20,40},transdate={"<$(=(#CurrentDate -2))"}>}goodqty)-
sum ({<invtype={34,42},transdate={"<$(=(#CurrentDate -2))"}>}goodqty)
the second for the case CurrentDate is a field with more then one value
sum ({<invtype={20,40}>}if(transdate<CurrentDate -2,goodqty))-
sum ({<invtype={34,42}>}if(transdate<CurrentDate -2,goodqty))
hope its helps you
Hi GandalfGray and Guys:
Thanks you for your reply.
I try your Expression
sum(if(transdate<CurrentDate -2,
if (invtype='20',goodqty) - if (invtype='34',goodqty)
+
if (invtype='40',goodqty) - if (invtype='42',goodqty))
))
The result is Zero.
No sure what happen.
Hi liron baram:
I am not able to try your Expression because I am not able to use Set Analysis as I am using Qlikview 7.5.
There must be something wrong somewhere that I just can not pin point it…
Could anyone please help?
Thanks a lot
not sure if this is wat you want.. but you can try this...
if(transdate < (CurrentDate -2), sum(Qty),
(if (invtype='20',sum(goodqty)) - if (invtype='34',sum(goodqty))) +
(if (invtype='40',sum(goodqty)) - if (invtype='42',sum(goodqty)))
)
hope this helps...
Hi richardgan
I suggest you build the statement step by step and checks what part that makes you "lose" your expected data.
Starting with:
sum(if(transdate<CurrentDate -2, goodqty))
Make invtype a dimension and check what you get for all invtypes
If you get zero for all invtypes from that but are expecting something else you got to find why.
Hi GandalfGray:
Thanks for your reply I will try just that.
Hi aadilmadarveet:
May i know where the Qty come from?
My First Expression:
=sum(if(transdate<CurrentDate -2,Qty))
The first Expression I have is that I need to change the Qty to the following Expression.
sum (if (invtype='20',goodqty)) - sum (if (invtype='34',goodqty))
+
sum (if (invtype='40',goodqty)) - sum (if (invtype='42',goodqty))
That is where I am trying to solve.
Thank you all for your kind help.
Hi Richard,
I Think you can try this..
You can create a variable for CurrentDate -2 and then use it in the expression...
Sum({<transdate={"<$(DateVariable)"}>} (
(sum (if (invtype='20',goodqty)) - sum (if (invtype='34',goodqty)))
+
(sum (if (invtype='40',goodqty)) - sum (if (invtype='42',goodqty)))
))
hope i understand your question and providing some valuable solution..
thanks,
aadil