Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I have columns like Date, Exchange_rate, Cost, Cost_Currency
Cost_Currency has MXN ,CAD,USD currencies . MXN and CAD has to be converted to USD.
Each date has exchange rate
Moreover Exchange_rate is in one table section and other columns are in other table section.
How can I convert Cost conversion of MXN and CAD to USD by using exchange rates and cost for each date.
Help me with expression that will be helpful for my conversion
Please help me
Thanks in advance!!
Sum(Cost * Exchange_rate) would be typical, though the answer may differ depending on your data structure.
It seems you keep asking this question but you're not happy with the answers, so perhaps you could be more clear about what exactly your issue is and provide a sample data set and expected result?
https://community.qlik.com/t5/App-Development/Currency-conversion-qlik-sense/m-p/1954542#M78725
https://community.qlik.com/t5/New-to-Qlik-Sense/Currency-Conversion/m-p/1951291#M209195
If you've already matched the dates and the tables are joined on MOVE_DATE, with each MOVE_DATE, and presumably also the TO and FROM currencies, you shouldn't need anymore more than Cost * Rate. If you haven't joined the tables in this manner, you would probably want to do so. If your table is actually one line with fields such as e.g. CAD_TO_USD, MXN_TO_USD etc, you would just write simple if() statements to pick out the correct field, such as Sum(Cost * if(Cost_Currency = 'CAD',CAD_TO_USD'if(Cost_Currency='MXN',MXN_TO_USD,1))).
I'm sorry, I don't understand your question past what I already suggested. Since your specific data structure isn't clear, I did my best to answer that question for multiple options, but if none of them covers your use case then I'm afraid I'd need more information.
I think I already did. You would join the tables as I suggested above and then multiply the cost by the rate.
Here's a rough example:
Load Line, Amount, Currency as FromCurrency, 'USD' as ToCurrency, Date#(Date) as Date INLINE [
Line, Amount, Currency, Date
1, 10, USD, 01/01/2022
2, 15, MXN, 02/02/2022
3, 20, CAD, 03/03/2022];
Left Keep
Load Date#(Date) as Date, FromCurrency, ToCurrency, Rate INLINE [
Date, FromCurrency, ToCurrency, Rate
01/01/2022, MXN, USD, 2.5
01/01/2022, CAD, USD, 1.2
02/02/2022, MXN, USD, 2.6
02/02/2022, CAD, USD, 1.1
03/03/2022, MXN, USD, 2.7
03/03/2022, CAD, USD, 0.8
];