Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Mous007
Helper IV
Helper IV

default report currency and Dynamic currency conversion

hello all,

 

I have been tasked to develop a payables report page and I have several reports from different countries. Each country has invoices that can be paid in local currency but in foreign currency also as you can see in the extract below. 

 

The area where i need serious help is if anybody can help me understand

  1. How i can set up the default currency for EUR (meaning that i want the report to dynamically convert all invoices amount to EUR)
  2. how i can set up a filter on the page where my users can switch the full report numbers to another currency (other than EUR)

I have been provided with a currency table and i think it should be used as a sort of converter but i am not really sure how to use it. The currency table is also attached below.

 

IF anybody can help me start this currency conversion issue i would really appreciate it. or at least guide me on where or what should i be looking for to solve the issue. any other infos or details needed please let me know.

Invoice NumInvoice AmountCurrency Code
Invoice 1254.57AUD
Invoice 2608.08AUD
Invoice 36114.84AUD
Invoice 4898.03AUD
Invoice 5160AUD
Invoice 63953.4AUD
Invoice 74135.42AUD
Invoice 811477.8AUD
Invoice 9942.5AUD
Invoice 103605.47EUR
Invoice 1118685.84EUR
Invoice 126988.8EUR
Invoice 137474.34EUR
Invoice 1432732.2EUR
Invoice 1518919.69GBP
Invoice 16964.51GBP
Invoice 176872.54GBP
Invoice 18126.86MYR
Invoice 1927790.35MYR
Invoice 20342033.86SGD
Invoice 213228.91SGD
Invoice 223228.91SGD
Invoice 2321526.08SGD

 

 

CURRENCY_IDVALUE
AED0.23364486
AFN0.011764706
ALL0.007692308
AMD0.001785714
ANG0.4784689
AOA0.003448276
ARS0.023809524
AUD0.632911392
AWG0.4784689
AZN0.505050505
BAM0.511247444
BBD0.429184549
BDT0.010204082
BGN0.511247444
BHD2.272727273
BIF0.000487805
BMD0.854700855
BND0.628930818
BOB0.12345679
BRL0.222222222
BSD0.854700855
BTN0.0125
BWP0.083333333
BYN0.431034483
BZD0.429184549
CAD0.649350649
CDF0.000531915
CHF0.864304235
CLP0.001315789
CNY0.12987013
COP0.000290698
CRC0.001515152
CUC0.854700855
CVE0.009090909
CZK0.038461538
DJF0.004830918
DKK0.133333333
DOP0.017241379
DZD0.007142857
EGP0.04784689
ERN0.057142857
ETB0.030864198
EUR1
FJD0.409836066
GBP1.136363636
GEL0.34965035
GHS0.178571429
GMD0.017857143
GNF9.5057E-05
GTQ0.114942529
GYD0.004291845
HKD0.10989011
HNL0.035842294
HRK0.135135135
HTG0.012987013
HUF0.003030303
IDR5.98802E-05
ILS0.234741784
INR0.0125
IQD0.000718907
IRR1.08696E-05
ISK0.008130081
JMD0.006622517
JOD1.207729469
JPY0.0078125
KES0.008474576
KGS0.0125
KHR0.000210526
KMF0.002040816
KPW0.006666667
KRW0.000769231
KWD2.83286119
KYD1.020408163
KZT0.002512563
LAK0.000102354
LBP0.000569152
LKR0.005405405
LRD0.005649718
LSL0.0625
LYD0.625
MAD0.090909091
MDL0.05
MGA0.000253807
MKD0.016129032
MMK0.000632911
MNT0.000348189
MOP0.106382979
MRU0.025
MUR0.024630542
MVR0.055555556
MWK0.001182033
MXN0.043478261
MYR0.212765957
MZN0.014492754
NAD0.0625
NGN0.002380952
NIO0.027027027
NOK0.105263158
NPR0.0078125
NZD0.581395349
OMR2.227171492
PAB0.854700855
PEN0.261780105
PGK0.261096606
PHP0.016129032
PKR0.007042254
PLN0.228832952
PYG0.000150602
QAR0.235849057
RON0.214592275
RSD0.008474576
RUB0.01369863
RWF0.000980392
SAR0.228832952
SBD0.10989011
SCR0.063291139
SDG0.047619048
SEK0.096153846
SGD0.628930818
SLL0.000104603
SOS0.001492537
SRD0.114942529
SSP0.006134969
STN0.04
SYP0.001666667
SZL0.0625
THB0.025641026
TJS0.090909091
TMT0.25
TND0.328947368
TOP0.383141762
TRY0.161290323
TTD0.126582278
TWD0.028169014
TZS0.000377358
UAH0.032258065
UGX0.000221239
USD0.854700855
UYU0.027027027
UZS0.000108932
VEF8.92857E-06
VES0.01369863
VND3.73134E-05
VUV0.007751938
WST0.333333333
XAF0.00152439
XCD0.316455696
XDR1.213592233
XOF0.00152439
XPF0.008403361
YER0.003424658
ZAR0.0625
ZMW0.086206897

 

Thanks in advance.

Mous

11 REPLIES 11
jdbuchanan71
Super User
Super User

Hello @Mous007 

Your currency table is the conversion rates from any currency to EUR so we can join it to the invoice table on the currency ID and do a calculation like so to go from invoice currency to EUR.

2020-05-15_14-44-33.jpg

Invoice Amount EUR = SUMX(Invoices,Invoices[Invoice Amount] * RELATED(Currencies[VALUE]))

 

Now that we have the EUR amount we can use a copy of the currency table to let the user select another conversion rate and take all invoices from EUR to the selected rate.

2020-05-15_14-45-45.jpg

Invoice Amount Selected Currency = 
VAR _ConversionRate = SELECTEDVALUE('Currencies Disconnected'[VALUE],1)
RETURN DIVIDE([Invoice Amount EUR],_ConversionRate)

In this measure, if no selection is made or they select multiple "secondary conversion" currencies it will leave the amount in EUR otherwise it will convert to the selected currency.  In my screen shot below I show invoice amount in original currency, EUR and AUD (I have AUD selected from the disconnected table).  You can see the first and third columns match for invoices that were in AUD to begin with.

2020-05-15_14-49-54.jpg

My sample file is attached for you to look at.

 

hi @jdbuchanan71 , thanks a lot for your support.

 

Your solution works perfectly for my business issue. One more question, so from now on whenever i am trying to use my payables/invoice amount in any type of calculation, i should always refer to the measure in selected currency ? or do you think i do do it in some other way ?

 

Thanks in advance 

 

I will mark ur post as a solution but i want to wait for @Greg_Deckler  repose as i want to try out the solution he provided two.

Many thanks to you both. different approaches but i am learning from  both.

You could use the [Invoice Amount Selected Currency] and have the report default to EUR.  That would probably be easiest for your users.

Hi @jdbuchanan71 , thank you for the clarification.

 

I just had another question that came to my mind while trying to build my main measures.

 

So based on my understanding in your scenario using this technique, if for example i had different kpi's or metrics i want to use in my model such as: Invoice amount(which we already calculated), Remaing amount, Approved amount , Paid amount etc.... , it means that for each one of these i will have to create two separate measure for each ?

 

Is there any method i can use to optimiye my calculation ? instead of having several measures on my measure table ?

 

I was thinking of creating a measure with multiple varibles such as the one used by Greg above where i can basically group both measures into one ?

 

Please let me know if that is the best approach or if you have any other suggestions.

 

Many thanks again.

Hello @Mous007 

You can do it all in 1 step, I just had two because of your request to always have EUR available.

Invoice Amount Converted = 
VAR _ConversionRate =
    SELECTEDVALUE ( 'Currencies Disconnected'[VALUE], 1 )
RETURN
    SUMX (
        Invoices,
        DIVIDE (
            Invoices[Invoice Amount] * RELATED ( Currencies[VALUE] ),
            _ConversionRate
        )
    )

You would just change the column feeding into the measure for each of your calcs:

2020-05-17_6-45-40.png

It's working! Thank you so much!

First I used the original currencies table and it didn't work because the lines were filtered, but with the disconnected copy of the currencies table it's just fine!

Thank you @jdbuchanan71 , i am still getting the same correct results with in EUR and of course whenever i change the currency from the disconnected slicer everything is working as expected.

 

Many thanks again.

Greg_Deckler
Super User
Super User

I have nearly this exact scenario in my book, DAX Cookbook. Crafting Currency Exchange rates, Chapter 5, page 184. Mine might be a little more complicated than yours because my scenario has the currency exchange rate change over time.

 

It goes something like the following:

 

Reporting Amount = 
    VAR __ReportingCurrency = SELECTEDVALUE('R08_Currencies'[Currency])
    VAR __SalesCurrency = MAX('R08_Sales'[Currency])
    VAR __SalesDate = MAX('R08_Sales'[Date])
    VAR __SalesAmount = SUM('R08_Sales'[Amount])
    VAR __ExchangeRateDate = 
        MAXX(
            FILTER(
                'R08_Rates',
                    'R08_Rates'[Date] <= __SalesDate &&
                        'R08_Rates'[From] = __SalesCurrency &&
                            'R08_Rates'[To] = __ReportingCurrency
            ),
            'R08_Rates'[Date]
        )
    VAR __ExchangeRate = 
        IF(__SalesCurrency = __ReportingCurrency,
            1,
            MAXX(
                FILTER(
                    'R08_Rates',
                    'R08_Rates'[Date] = __ExchangeRateDate &&
                        'R08_Rates'[From] = __SalesCurrency &&
                            'R08_Rates'[To] = __ReportingCurrency
                ),
                'R08_Rates'[Rate]
            )
        )
RETURN
    __ExchangeRate * __SalesAmount

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Greg,

I have used the Code below that is your's and I have had success with it in certain situations but I haven't quite got what I need and was hoping for a couple of pointers.

 

I have a Sales table which has a an amount column and in that column it has amounts for USD, EUR and GBP.  I also have a CurrencyID Column that tells me what the Currency is.  I need to convert that column into a single Currency which will be decided by the User via a Slicer.  I have used your measure below to do that and it works brilliantly when I select Sales Records for a Single Currency on a Single Date.  I think the reason it isn't working is the measure selects the Rate by MAXX Date and Currency and that isn't quite what I need but I cannot figure out how the iteration should work correctly.  Any help greatfully received, apologies if I shouldn't have contacted you.

 

Thanks

 

Chris

Anonymous
Not applicable

Hi Greg,

 

From what you are saying I think you have the solution I require.  We capture exchange rates for a number of countries on a daily basis and keep the in a table. We also have a sales table has an Amount column that can be in a number of Currencies, we know which currency from the CurrencyID Column in the Sales Table.

 

I would like to have a Slicer on a report where the user can pick the Reporting Currency.

 

Do you have a picture of your model that goes with the Dax Code that I can have a look at please.  

 

Thanks I hope you can help.

 

Chris

hI @Greg_Deckler , thank you for taking the time to go thru my post.

 

I have tried to use your measure but got stuck in the following line:

                        'R08_Rates'[From] = __SalesCurrency &&
                            'R08_Rates'[To] = __ReportingCurrency

 

I might be wrong but i think i am supposed to have the currency conversion rates on mz main fact invoices table ? Because now i have my invoices table and currency table on two distinct tables.

 

Maybe you can further help me with this ?

 

thanks in advance

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.