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
watje255_ju
Helper II
Helper II

FX Translation for multiple currencies to a single currency

Hello, 

 

I am wanting to convert each transaction value to NZD, at the selected reporting date. 

 

I am currently getting this error, can anyone help with my dax please? 

watje255_ju_1-1657072558584.png

watje255_ju_2-1657072863836.png

Thanks for your time

 

PBIX file saved here https://1drv.ms/u/s!As8wMr9_bgGrgV_K1Sal9sTZWorC?e=i2QnjE

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @watje255_ju ,

 

You may try this Measure.

FX Translation =
VAR FXTranslationDate =
    MAX ( DimDate[DateKey] )
VAR SelectedCurrencyKey =
    MAX ( FactAccountsReceivable[Company Key] )
VAR LookedExchangeRate =
    CALCULATE (
        MAX ( FactExchangeRate[Exchange Rate] ),
        FILTER (
            FactExchangeRate,
            FactExchangeRate[Valid From] = FXTranslationDate
                && FactExchangeRate[To Currency Key] = SelectedCurrencyKey
        )
    )
RETURN
    // SUMX( FactAccountsReceivable,
    //  FactAccountsReceivable[Amount Currency] /
    //          LOOKUPVALUE( FactExchangeRate[Exchange Rate],
    //              FactExchangeRate[Valid From], FXTranslationDate,
    //              FactExchangeRate[To Currency Key], FactAccountsReceivable[Currency Key]) )
    SUMX (
        FactAccountsReceivable,
        FactAccountsReceivable[Amount Currency] / LookedExchangeRate
    )

 

The result looks like this.

vcazhengmsft_0-1657245020189.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

4 REPLIES 4
v-cazheng-msft
Community Support
Community Support

Hi @watje255_ju ,

 

You may try this Measure.

FX Translation =
VAR FXTranslationDate =
    MAX ( DimDate[DateKey] )
VAR SelectedCurrencyKey =
    MAX ( FactAccountsReceivable[Company Key] )
VAR LookedExchangeRate =
    CALCULATE (
        MAX ( FactExchangeRate[Exchange Rate] ),
        FILTER (
            FactExchangeRate,
            FactExchangeRate[Valid From] = FXTranslationDate
                && FactExchangeRate[To Currency Key] = SelectedCurrencyKey
        )
    )
RETURN
    // SUMX( FactAccountsReceivable,
    //  FactAccountsReceivable[Amount Currency] /
    //          LOOKUPVALUE( FactExchangeRate[Exchange Rate],
    //              FactExchangeRate[Valid From], FXTranslationDate,
    //              FactExchangeRate[To Currency Key], FactAccountsReceivable[Currency Key]) )
    SUMX (
        FactAccountsReceivable,
        FactAccountsReceivable[Amount Currency] / LookedExchangeRate
    )

 

The result looks like this.

vcazhengmsft_0-1657245020189.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

Hi @v-cazheng-msft  thank you very much!! I just changed the 

VAR SelectedCurrencyKey =
    MAX ( FactAccountsReceivable[Company Key] )

company key to currency key and then the formula worked perfectly, thank you so much! 

amitchandak
Super User
Super User

@watje255_ju , you lookup is giving more then one value.

 

Put it inside minx/maxx /Averagex

 

Minx(Table, <Your lookup code>)

Hi @amitchandak , thanks for your reply, could you clarify where abouts in the Dax formula? 

FX Translation =
VAR FXTranslationDate =MAX(DimDate[DateKey])

Return SUMX( FactAccountsReceivable,
    FactAccountsReceivable[Amount Currency] /
            LOOKUPVALUE( FactExchangeRate[Exchange Rate],
                FactExchangeRate[Valid From], FXTranslationDate,
                FactExchangeRate[From Currency Key], FactAccountsReceivable[Currency Key]) )
 
Thanks!!
 

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.

Top Solution Authors