Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If next row is 'Production' then...

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.

13 Replies
anbu1984
Master III
Master III

Can you provide sample input and expected output

jagan
Partner - Champion III
Partner - Champion III

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.

richard_chilvers
Specialist
Specialist

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 !

Not applicable
Author

Jagan,

is it possible to give the condition in the expression instead of Script?

jagan
Partner - Champion III
Partner - Champion III

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.

Not applicable
Author

Dear Richard,

Can you give me an example for this?

Not applicable
Author

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.

richard_chilvers
Specialist
Specialist

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.

Not applicable
Author

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).