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

Multiply Table content by Cofficient

Good moring,

I ask for your advice because I want to do calculating in a script.

I really don't know how to write relation.

Table [Investissement]     Table [ki]

A                                       k1

B                                       k2

C                                       k3

..                                        ..

..                                        ..

N                                        kn

To obtain Sum (A*k1 + B*k2 + C*k3.... N*kn)

And realised the Sum of all multiply

Do y use loop ? and Incrément ?

Thanks for your reply

Alphonse

10 Replies
Anonymous
Not applicable
Author

Alphonse

Is there a common field between your 2 tables that can be used to link them ?

  • [Investissement]   
  • [ki]

Best Regards,     Bill

Not applicable
Author

Hello,

Tkanks for your reply.

No, there are 2 tables independants

Anonymous
Not applicable
Author

Alphonse

How would one know which row value from [Investissement] to multiply with which row value from [ki] ?


And what table with what fields would you want this calculated value placed in ?


I am quite confused here, so it would be great if you could share a sample qvw, with some sample data via an Inline load, plus a description of the output table field you are after ?



Best Regards,     Bill



Not applicable
Author

Hello,

If I understand, maybe you can try something like this

Not applicable
Author

Good morning,

Sorry, I can't read Test.qvw, because I am testing this produit.

In fact I try to calculate IRR on a projet. I have 2 tables : Resultat and Coefficient as this picture.

Actually I do this on Excel file and after reload the result. But I would like to try multiply this 2 tables in another table result which is empty at the begining. And if possible to make SUM of all figures.

But I am beginner on QV...

Tkanks in advance

Alphonse

Not applicable
Author

Hi,

I forgot to join the pic onirr_projet.jpg tables

Anonymous
Not applicable
Author

Alphonse

If your source data is in Excel file could you share them with us ?


Best Regards,     Bill

Not applicable
Author

Hello Bill,

Yes

I have 2 tables : Resultat and Coefficient

I would like in QV multiply each ligne and obtain calculation and a Resulte table. And If possible make the Sum of all data in Result.

Thanks in advance.

Alphonse

Not applicable
Author

Hello Alphonse,

The script in Test.qvw is the following:

TABLE_1_TMP:

LOAD * INLINE [

    FirstColumnT1

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

];

TABLE_2_TMP:

LOAD * INLINE [

    FirstColumnT2

    5.5

    3.2

    1.9

    4.3

    8.0

    7.5

    2.2

    9.1

    0.8

    7

];

TABLE1:

LOAD FirstColumnT1 as Investissement,

  RowNo() AS INDICE

Resident TABLE_1_TMP;

DROP Table TABLE_1_TMP;

Join(TABLE1)

TABLE2:

LOAD FirstColumnT2 as ki,

  RowNo() as INDICE

Resident TABLE_2_TMP;

DROP Table TABLE_2_TMP;

TABLE3: // RESULT

LOAD *,

  Investissement*ki as Result

Resident TABLE1;

DROP Table TABLE1;

Best regards.