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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.