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
bsz412
Helper III
Helper III

fixing DAX formula - exchange rate

Hi, 

 

I need to convert local currency amounts to EUR by using the exchange rate of the selected end-year and the last available month of that year. I have a formula that works, but it does not use the same ex rate for each month: 

first column is a date column from a date table

second is the local currency amount

3rd: result of my Vlookup ex rate conversion dax measure

4th: ex rate test: shows what ex rate the vlookup measure used

the last 2 columns are the result of 2 measures: 

End month number =
VAR _maxyear = MAX('year_selector'[year])
RETURN
CALCULATE(
    MAX(purchases_by_week_vendor[month]),
    ALL(purchases_by_week_vendor),
    purchases_by_week_vendor[StartYear]=_maxyear
    )
 
End year number =
    MAX('year_selector'[year])
 

bsz412_0-1674060092963.png

the 2 measures show the same, correct month and year in this table, however in the Vlookup dax measure these values are changing: 

 

Sell-in EUR Vlookup =
SUMX (
    purchases_by_week_vendor,
    VAR exchRate =
       
            LOOKUPVALUE (
            exchange_rates[avg_rate],
            exchange_rates[source_currency_code], purchases_by_week_vendor[currency_code],
            exchange_rates[year], MAX ( year_selector[year]) ,
            exchange_rates[month], [End month number]
        )
 
RETURN
         [Sell-in local currency (test)] * exchRate
)
 
The issue is, that the year_selection table is connected to the date table. I cannot inactivate that relationship as the datamodel is used for several reports and I cannot change that relationship. 
As I see the formula is correctly choosing the year, but the month is not consistent in the monthly breakdown. 
 
If selected year is 2022, latest available month in the fact table is November, so the 2022 nov ex rate should be used for each and every month. 
 
bsz412_1-1674060582024.png

 

Any idea how I could fix this formula?

thank you !

0 REPLIES 0

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.