Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
kaushi2020
Creator II
Creator II

How to calculate value based on currency

Hi All, I have below dataset. I want to display a calculated value based on the currency column. 

Eg: if currency = Euro cents then value= value/100. similarly for GBP cents.

I want to implement above logic in load script. So that when I see final data in Data model viewer, I will be able to see calculated value (if the currency is in cents or pence) and values in Currency column should also display GBP and EUR only in Data model viewer.

 

Currency Value
EUR 100
NOK 200
USD 205
Euro cents 302
GBP pence 123
GBP 245
PLN 256
CHF 311
AUD 456
SEK 857
SGD 987
CZK 101
DKK 202
RON 201
TRY 332

 

Expected output:

Currency Value
NOK 200
USD 205
Euro 3.02
GBP 1.23
PLN 256
CHF 311
AUD 456
SEK 857
SGD 987
CZK 101
DKK 202
RON 201
TRY 332

 

thanks in advance.

Labels (1)
1 Reply
marcus_sommer

Maybe with something like this:

load
   subfield(Currency, ' ', 1) as Currency,
   if(wildmatch(Currency, '*cents*', '*penny*'), Value / 100, Value) as Value,
   ....