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
pswprimera
Helper I
Helper I

Currency Exchange rate today only

Hello,

 

I have what seems to be a tricky task using DAX in Power BI.

 

I have 3 columns

 

Date

Amount

exchange rate

 

I need todays exchange rate only to calculate historical revenue. I dont want to use tomorrows exchange rate to calculate tomorrows revenue.

 

Amount / exchange rate (today) = Revenue

 

The 4th Column or Measure Revenue must only use todays exchange rate.

 

Please help I've tried everything and it seems over complicated.

 

 

1 ACCEPTED SOLUTION

Thank you for working this one out. Much appreciated. The following is a very good solution:

 

Ex Rate = MAXX(FILTER(ALL('price'),'price'[creation_time]=TODAY() &&'price'[currency]=EARLIER('price'[currency])),'price'[EX Rate])

 

followed by for if you have multiple currencies in your data when calculating revenue:

 

Current / Ex Rate =
var temp= MAXX(FILTER(ALL('price'),'price'[creation_time]=TODAY() &&'price'[currency]=EARLIER('price'[currency])),'price'[EX Rate])
return
IF('price'[strRefKey]= "DKK"||
'price'[strRefKey]= "NOK"||
'price'[strRefKey]= "SEK"||
'price'[strRefKey]= "ISK",'price'[Amount] / temp ,
BLANK()
)

 

 

View solution in original post

27 REPLIES 27

Still not a work around for the date. The values always revert back to the originasl date or are accuracy is not correct. Are there any other more simpler solutions for what is a potentially simple calculation?

Hi @pswprimera,

 

Since I still not clear for your table structure and relationships, can you share me a pbix file with sample data, I will modify the formula based on it.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

There are two tables with no relationships. There is a power bi left outer join to bring in exchange rate. Do you need the pbix file for this?

 

 

Hi @pswprimera,

 

>>var temp=MAXX(FILTER(ALL('price'),'price'[Date]=EARLIER('asgardprod pnr_price'[Date])&&'price'[EXRATE]=EARLIER('price'[EXRATE])),'price'[EXRATE])

You said these table not contain the relationship, why you use the earlier function on an unrelated column?

 

>>Do you need the pbix file for this?

Can you please upload it and share us a 1dr link?

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @pswprimera,

 

You can refer to below attachment file.

 

BTW, the conditions of lookupvalue are use "and" to link, if you add multiple conditions, it will try to find out the records which match all of the conditions.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you for working this one out. Much appreciated. The following is a very good solution:

 

Ex Rate = MAXX(FILTER(ALL('price'),'price'[creation_time]=TODAY() &&'price'[currency]=EARLIER('price'[currency])),'price'[EX Rate])

 

followed by for if you have multiple currencies in your data when calculating revenue:

 

Current / Ex Rate =
var temp= MAXX(FILTER(ALL('price'),'price'[creation_time]=TODAY() &&'price'[currency]=EARLIER('price'[currency])),'price'[EX Rate])
return
IF('price'[strRefKey]= "DKK"||
'price'[strRefKey]= "NOK"||
'price'[strRefKey]= "SEK"||
'price'[strRefKey]= "ISK",'price'[Amount] / temp ,
BLANK()
)

 

 

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.