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

Convert value by currency

Hello,

I want to convert all values from a table by currency. So , I have two tables like this:

CustomerIDCurrencySales
1RON100
1EUR200
1USD150
CurrencyVariation(RON)
RON1
EUR4.4610
USD3.9492

I want to have a 4th column in the first table named EQRON in wich I want to calculate all values to RON.

Example : For the row where we have EUR : the value for EQRON should be : 200 * 4.4610.

Can you please help me?

Thanks.

1 Solution

Accepted Solutions
saikatghosh
Contributor III
Contributor III

Hi Razvan,

You can try this

Table1:
LOAD * INLINE [
CustomerID, Currency, Sales
1, RON, 100
1, EUR, 200
1, USD, 150
]
;

Left Join (Table1)
LOAD * INLINE [
Currency, Variation(RON)
RON, 1
EUR, 4.4610
USD, 3.9492
]
;

Table:
LOAD
CustomerID,
Currency,
Sales,
(
Sales*[Variation(RON)]) as EQRON
Resident Table1;

DROP Table Table1;

View solution in original post

7 Replies
beck_bakytbek
Master
Master

Hi Razvan,

you can try to use a variable in this case,

check this : Creating and understanding variables in QlikView - YouTube

i hope that helps

beck

agomes1971
Specialist II
Specialist II

Hi,

you can those calculations on the load script:

like

tab:

load * inline

[

customer,  currency, sales, eqron

1, RON, 200, 200*4.4610

];

or

tab:

Load *;

SQL SELECT customer,  currency, sales, if(currency='RON', sales*4.4610

FROM your_table;

or

if you want to use your two tables just make a letf join between them.

HTH

André Gomes

yasmeenk
Partner - Creator
Partner - Creator

Hi Razvan,

Is this are you looking for?

saikatghosh
Contributor III
Contributor III

Hi Razvan,

You can try this

Table1:
LOAD * INLINE [
CustomerID, Currency, Sales
1, RON, 100
1, EUR, 200
1, USD, 150
]
;

Left Join (Table1)
LOAD * INLINE [
Currency, Variation(RON)
RON, 1
EUR, 4.4610
USD, 3.9492
]
;

Table:
LOAD
CustomerID,
Currency,
Sales,
(
Sales*[Variation(RON)]) as EQRON
Resident Table1;

DROP Table Table1;

razvan_brais
Creator III
Creator III
Author

Hy , I haven`t tried yet the suggestions. I will come back with a response as soon as possible

Thank you.

razvan_brais
Creator III
Creator III
Author

Hy Saikat Ghosh.

That is what i was looking for.

Thank you.

oknotsen
Master III
Master III

If your question is now answered, please flag the Correct Answer (via the big "Correct Answer" button near every post) and Helpful Answers (found under the Actions menu under every post).

If not, please make clear what part of this topic you still need help with .

May you live in interesting times!