Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Iterative Calculation in Qlikview

i,

in the image below, Net Profit is calculated as follows;

NetProfit = B1-B2-B3

The field Salaries is calculated

Salaries = 0.1 * B4

This is allowed in excel with the option iterative calculation, as the field B3 is used in both calculations of NetProfit and Salaries.

Sheet1.png

How can I apply the same in a qlikview application.

1 Solution

Accepted Solutions
dinuwanbr
Creator III
Creator III

5 Replies
marcus_sommer

I don't know how these iterations will be made (probably some kind of random-function which runs x-time and the average will taken) and think they are not really predictable. I personal would prefer a multi-stage margin-calculation like:

    Sales

-  Material

=  Margin 1

-  Rents

=  Margin 2

-  Salaries

=  Margin 3

....

- Marcus

hic
Former Employee
Former Employee

If you do it in the script, you can use the Peek() function to address above records. If you do it in a chart in the UI, you can use the Above() function. But you cannot have recursive definitions as you have in your example, where NetProfit is calculated from Salaries, and Salaries is calculated from NetProfit.


Further, in both databases and in QlikView/Qlik Sense, you should usually not store different things in the same column and let the order define what it is. Instead you should have them in different columns and name the columns appropriately. Then it is easy to do what Marcus suggests - which is also how I would do it.

HIC

dinuwanbr
Creator III
Creator III

Hi,

PFA

Rgds,

Dinu1

Not applicable
Author

This was just an example for a real time implementation where there are two fields which are calculated recursively. Will try to avoid recursive definitions for sure Thank you

Not applicable
Author

Hi Marcus,

Thanks for the response Will try it out