Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Recursive calculation in script

Hi,

Can anyone tell me how can i do it (following) in Qlikview? As per my finding it can not be done, if so what are the workarounds that anyone suggest?

Table-A

RowEFG
10.01110.22220.1222
20.33330.44440.2322

Table-B

RowABCD
1100A+(A*E)B+(B*F)C+(C*G)

Thanks and Regards

5 Replies
stigchel
Partner - Master
Partner - Master

Not sure what your real requirement is, but if you are worried about recursive calculations and looking for a way to perform them only once (instead of getting a lengthy formula for D, with calculations already done in C,B and A) ...

You can use preceding loads:

Table1:

LOAD Row,

     E,

     F,

     G

FROM

[https://community.qlik.com/thread/238928]

(html, codepage is 1252, embedded labels, table is @1);

Table2:

Load Row,A,B,C,D;

Load *, C+(C*G) as D;

Load *, B+(B*F) as C;

Load *, A+(A*E) as B;

Load *,100 As A Resident Table1;

stigchel
Partner - Master
Partner - Master

Qvw attached

Not applicable
Author

Thanks Piet for your reply.

Please refer to the snapshot pasted below:

Table A - from row 4-6 (few selected rows)

Table B - from row 50 - 53 (few selected rows)

analysis.png

I have approx 300 columns (date) which are dynamic and grows with time.

Now, the recursive calculation occurs in the second table starting from row 49. The calculation refers to data in table A than a cell value is calculated than that value is used in the next cell of table B which can be expressed like this for cell D and E in table B and carried forward in the same manner for the remaining columns:

Table B, Cell 😧     =C50+C50*D4

Table B, Cell E:     =D50+D50*E4 ...

I hope i've made myself clear; as you might note i have created a cross table of the above, so the date and sectors are rows.

MarcoWedel

please post some sample data as file not as screenshot to test with.

I guess you want to crosstable load your table at first instead of dealing with constantly growing column/field numbers?!?!

thanks

regards

Marco

MarcoWedel

Hi,

one example using your first table (Table-A):

QlikCommunity_Thread_238928_Pic1.JPG

QlikCommunity_Thread_238928_Pic2.JPG

QlikCommunity_Thread_238928_Pic3.JPG

QlikCommunity_Thread_238928_Pic4.JPG

TableA:

CrossTable(attribute, data)

LOAD Row,

    E,

    F,

    G

FROM [https://community.qlik.com/thread/238928] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco