Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Maybe with something like this:
load
subfield(Currency, ' ', 1) as Currency,
if(wildmatch(Currency, '*cents*', '*penny*'), Value / 100, Value) as Value,
....