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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
akim_no
Frequent Visitor

Revenue in Different Currencies

I need to analyze the revenue in local currency and in euros. For each month, we have the amount in local currency for the current year (Local Currency N) and for the previous year (Local Currency N-1). The amount for the previous year is calculated using the following formula:

 

Formula 1 - Local Currency N-1:
VAR PreviousYear = SELECTEDVALUE(Calendar[year]) - 1
VAR RPrevious = CALCULATE([Local Currency], Calendar[year] = PreviousYear)
RETURN RPrevious
```

I want to convert these amounts into euros using a specific exchange rate chosen by the user. The user selects the month and year in the 'MonthYear' column, formatted as 'MM-yyyy'. Based on this selection, the corresponding exchange rate is identified. This rate is stored in the 'rate' table, which is independent of the main semantic model.

Next, I generate the revenue in euros for the current year using the subsequent formula:

 

Formula 2 - Revenue € N :
VAR PeriodMonthYear = SELECTEDVALUE('rate'[MonthYear])
VAR RevenueInEuro = SUMX(
'Revenue',
DIVIDE(
'Revenue'[Local Currency N],
COALESCE(
LOOKUPVALUE('rate'[rate], 'rate'[currency_id], 'Revenue'[currency_id], 'rate'[MonthYear], PeriodMonthYear),
1
)
)
)
RETURN RevenueInEuro
```

When attempting to apply the same method to 'Currency Revenue N-1', although I can retrieve the appropriate values, the division results become incomprehensible.

 

Formula 3 - Revenue € N-1 (formula) :

VAR MonthYear = SELECTEDVALUE('rate'[MonthYear])
VAR PYYear = SELECTEDVALUE(Calendar[year]) - 1
VAR RevenueLocal = CALCULATE([Local Currency N], Calendar[year] = PYYear)
VAR CurrentCurrency = SELECTEDVALUE('Revenue'[currency_id])
VAR Rate = CALCULATE(
LOOKUPVALUE(
'rate'[rate],
'rate'[currency_id], CurrentCurrency,
'rate'[MonthYear], MonthYear
)
)
RETURN RevenueLocal & "/" & Rate
```

**Formula 4 - Revenue € N-1 (formula output) :
VAR MonthYear = SELECTEDVALUE('rate'[MonthYear])
VAR PYYear = SELECTEDVALUE(Calendar[year]) - 1
VAR RevenueLocal = CALCULATE([Local Currency], Calendar[year] = PYYear)
VAR RevenueEuro = SUMX(
'Invoice',
RevenueLocal /
COALESCE(
LOOKUPVALUE(
'rate'[rate],
'rate'[currency_id], 'Revenue'[currency_id],
'rate'[MonthYear], MonthYear
),
1
)
)
RETURN RevenueEuro

 

The table presents the results of the measures :

 

akim_no_2-1735653612981.png

If anyone can help me to resolve this issue.

Thankx

11 REPLIES 11
akim_no
Frequent Visitor

@Ashish_Mathur 

Rate 

Ratecurrency_codecurrency_idrate_monthrate_yearmonthYear
1.10USDUSDJanuary202301/2023
1.15USDUSDFebruary202302/2023
1.25USDUSDMarch202303/2023
1.00EUREUROctober202310/2023
1.00EUREURNovember202311/2023
1.00EUREURDecember202312/2023
130.50JPYJPYSeptember202309/2023
131.00JPYJPYOctober202310/2023
0.78GBPGBPSeptember202409/2024
0.80GBPGBPOctober202410/2024
1.05CHFCHFAugust202308/2023
1.06CHFCHFSeptember202309/2023
0.68AUDAUDJuly202407/2024
0.69AUDAUDAugust202408/2024
0.76CADCADJune202306/2023
0.77CADCADJuly202307/2023
6.89CNYCNYMay202305/2023
7.00CNYCNYJune202306/2023
74.25INRINRApril202404/2024
74.30INRINRMay202405/2024
1.36SGDSGDMarch202303/2023
1.37SGDSGDApril202304/2023

 

My Semantic model : 

akim_no_1-1735819139894.png

What I'm looking for : 

akim_no_0-1735819126356.png

 

 

 

 

Revenue Euro N-1 = 
VAR PYYear = SELECTEDVALUE(Revenue[Revenue year])-1
VAR PYRevenue = CALCULATE([Revenue N], (Revenue[Revenue year]) = PYYear)
VAR MonthYear = SELECTEDVALUE('Rate'[Rate]) 
VAR Revenue_Euro = SUMX(
    'Revenue',
    DIVIDE(
        PYRevenue, 
        COALESCE(
            LOOKUPVALUE(
                'Rate'[Rate],
                'Rate'[currency_code], 'Revenue'[currency_id],
                'Rate'[monthYear], MonthYear
            ),
            1
        )
    )
)
RETURN
Revenue_Euro

 

 

 

Still not very clear.  If possible, could you put this data in an MS Excel file and show the Excel formulas that you would have written to solve this problem.  I will convert those Excel formulas to measures/calculated columns.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I have uploaded a Power BI file with sample data at this link: https://github.com/akimno/power-bi.

  1. Converting revenue to euros:

    • The revenue is recorded in different currencies.
    • The user selects a month and a year using the filter (
      'Rate'[monthYear]).
    • Once the month and year are selected, I retrieve the exchange rate(
      'Rate'[Rate])
      for that period.
    • I divide the revenue amount in the local currency by the exchange rate to obtain the revenue in euros ('Revenue'[Revenue Euro N]).
  2. Comparison with the previous year:

    • I want to calculate the revenue in euros for the previous year in the same way ('Revenue'[Revenue Euro N-1]).
    • Then, I want to display the comparison between the two (for example, as a difference).

The problem: I’m unable to correctly display the value of the previous year’s revenue.

Hi,

Please also share the download link of 3 source Excel files.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 

Done 

See if this helps.

Ashish_Mathur_0-1736219341729.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello @Ashish_Mathur 
In my table, I have different currencies for local revenues. Will the "selected rate" automatically pick the corresponding rate for each currency to perform the conversion?

Please try yourself.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
akim_no
Frequent Visitor

@Ashish_Mathur 

 

Revenue Table : 

Revenue_idRevenue_idRevenue_line_idRevenue line numberRevenue numberRevenue product nameInvoiced quantityQuantityLocal RevenueDiscount rate
R001R001RL001145783Widget151585005%
R002R002RL002245874Super Widget202078003%
R003R003RL003345990Mega Widget10101010010%
R004R004RL004445001Economy Widget303012208%
R005R005RL005544675Premium Widget121253501%
R006R006RL006644232Widget Pro252543874%
R007R007RL007743890Widget Lite404034562%
R008R008RL008843558Widget Ultra505023695%
R009R009RL009943100Widget Standard100100157515%
R010R010RL0101042843Compact Widget353519627%
R011R011RL0111146002Advanced Widget181886006%
R012R012RL0121246123Basic Widget222279004%
R013R013RL0131346234Ultra Widget881020011%
R014R014RL0141446345Mini Widget282812409%
R015R015RL0151546456Giant Widget151554002%
R016R016RL0161646567Widget Extra303043005%
R017R017RL0171746678Widget Special454534003%
R018R018RL0181846789Widget Plus606023506%
R019R019RL0191946890Widget Supreme9595160014%
R020R020RL0202047001Widget Micro383819508%

 

Revenue details Table : 

Revenue_idRevenue_idRevenue_line_idRevenue line numberRevenue numberRevenue product nameInvoiced quantityQuantityLocal RevenueDiscount rate
R001R001RL001145783Widget151585005%
R002R002RL002245874Super Widget202078003%
R003R003RL003345990Mega Widget10101010010%
R004R004RL004445001Economy Widget303012208%
R005R005RL005544675Premium Widget121253501%
R006R006RL006644232Widget Pro252543874%
R007R007RL007743890Widget Lite404034562%
R008R008RL008843558Widget Ultra505023695%
R009R009RL009943100Widget Standard100100157515%
R010R010RL0101042843Compact Widget353519627%
R011R011RL0111146002Advanced Widget181886006%
R012R012RL0121246123Basic Widget222279004%
R013R013RL0131346234Ultra Widget881020011%
R014R014RL0141446345Mini Widget282812409%
R015R015RL0151546456Giant Widget151554002%
R016R016RL0161646567Widget Extra303043005%
R017R017RL0171746678Widget Special454534003%
R018R018RL0181846789Widget Plus606023506%
R019R019RL0191946890Widget Supreme9595160014%
R020R020RL0202047001Widget Micro383819508%

 

Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result very clearly.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
rajendraongole1
Super User
Super User

Hi @akim_no  - The formulas and table you've provided indicate that you're trying to correctly calculate revenue in euros for both the current year and the previous year using exchange rates selected by the user. However, based on your issue, it seems that there might be a problem with how the calculations are applied to the previous year's data.

 

Steps to Debug the Issue
Formula for Local Currency N-1:

Your Formula 1 seems correct for retrieving the previous year's local currency values. Ensure that the Calendar[year] column is properly populated and connected to your data model.
Revenue € N:

Formula 2 seems to correctly divide the current year's local currency by the exchange rate using LOOKUPVALUE. Ensure that:
The rate table is properly formatted.
currency_id and MonthYear values match correctly between the rate and Revenue tables.
Revenue € N-1:

The issue lies in applying the same logic to the previous year's data. In Formula 3, you're concatenating RevenueLocal and Rate for debugging. If the division in Formula 4 fails or gives incorrect results, here are some checks:
Ensure that RevenueLocal is correctly calculated for the previous year. Debug by isolating this variable's output.
Check whether the LOOKUPVALUE in Rate is returning the expected value. If not, confirm that MonthYear and currency_id are consistent in the rate table.
Exchange Rate Application for Previous Year:

When calculating Revenue € N-1, you need to ensure that the MonthYear column reflects the correct year. It might be necessary to adjust it to MonthYear for the previous year:
DAX
Copy code
VAR AdjustedMonthYear = FORMAT(DATE(PYYear, MONTH(Calendar[date]), 1), "MM-yyyy")
Test the Division Logic:

If Formula 4 outputs incomprehensible results, debug by testing each step:
Calculate and return just RevenueLocal.
Calculate and return just the Rate.
Divide the two in isolation to confirm their compatibility.

 

VAR MonthYear = SELECTEDVALUE('rate'[MonthYear])
VAR PYYear = SELECTEDVALUE(Calendar[year]) - 1
VAR AdjustedMonthYear = FORMAT(DATE(PYYear, MONTH(Calendar[date]), 1), "MM-yyyy")
VAR RevenueLocal = CALCULATE([Local Currency], Calendar[year] = PYYear)
VAR Rate = LOOKUPVALUE(
'rate'[rate],
'rate'[currency_id], 'Revenue'[currency_id],
'rate'[MonthYear], AdjustedMonthYear
)
VAR RevenueEuro = DIVIDE(RevenueLocal, COALESCE(Rate, 1))
RETURN RevenueEuro

 

Let me know if further adjustments are needed!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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