Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to calculate Amount (Qty x Unit Rate).
But the Condition is 'if the next row contains the words 'Production' then it should be 0, else it should be Qty x unit rate.
Can you provide sample input and expected output
Hi,
Try like this if you have a key field
LOAD
*,
If(WildMatch(Previous(FieldName), 'Production'), 0, Qty x [unit rate.]) AS Measure;
LOAD
*
FROM TableName
ORDER By KeyFieldName Desc;
Hope this helps you.
Regards,
Jagan.
Hi
I am guessing you're using a table in a chart.
I have had a similar requirement, and used the ABOVE or BELOW function to check the content of other rows.
You might want to give it a try.
Good luck !
Jagan,
is it possible to give the condition in the expression instead of Script?
Hi,
I think it is not possible, because for every row you need to calculate like this, but Qlikview calculates at chart level.
If you have this Dimension in Chart then try Above()
If(WildMatch(Above([Expression Name]), 'Production'), 0, Sum(Qty x [unit rate.]))
Hope this helps you.
Regards,
Jagan.
Dear Richard,
Can you give me an example for this?
Jagan,
It is almost working.
but i am not able to multiply with Unit rate., it is not able to identify x. (Multiplication).
if(wildmatch(Above([Description]),'Production'),0,(Quantity))
maybe mathematical functions will not work in this.
pls help.
It seems you have got close.
Perhaps you could use a variable to do the calculation?
Or remember that 0 x [unit rate] will always be zero, so perhaps you can resturcture the expression?
ABOVE/BELOW are not very elegant solutions, but I hope they work for you.
No Richard.
it is not working.
I am not getting an error, but still i don;t get the expected results.
is there a way to apply if condition based on text in next row. (other than below function).