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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
sunyangjun1115
Frequent Visitor

How to create a measure to calculate the sum amount of sales with a Target Currency (EUR)

Hi All,

 

need some help on  below requirment. 

 

i have a Sales Table in Power BI , it contains the amount of sales and the corrensponding Currency. see below screenshot.

ItemCurencyAmount
1CNY100
2CNY300
3HKD200
4INR1000
5INR2000
6NOK500

 

besides, i also have another table which contains the exchange rate with 2 years data.

YearFrom CurrencyTo CurrencyRateDescription
2023CNYEUR0.135In Year 2023, 1 CNY = 0.135 EUR
2023HKDEUR0.121 
2023INREUR0.012 
2023NOKEUR0.099 
2024CNYEUR0.127 
2024HKDEUR0.116 
2024INREUR0.011 
2024NOKEUR0.089 

 

my requirment is to create a measure which can calcuate the total amount of the sales with currency EUR, based on the selection of the year( put a slicer in the report page , it will has 2 value, one is 2023, and another is 2024). how to realize this ? 

 

sunyangjun1115_1-1716797917034.png

thanks in advance for your time and support. 

 

 

1 ACCEPTED SOLUTION

Hi,

Yes, sorry about that I forgot to fix the total calculation. 

To eur =
var _year = MAX('Table (39)'[Year])
var _vtable_rate = ADDCOLUMNS('Table (38)',"Rate",
var _currency = 'Table (38)'[Curency] RETURN
CALCULATE(MAX('Table (39)'[Rate]),_currency='Table (39)'[From Currency],'Table (39)'[To Currency]="EUR"))
RETURN

SUMX(_vtable_rate,
[Rate]*'Table (38)'[Amount])

Here I added SUMX and virtual table to account for empty filter context.
ValtteriN_0-1716818848062.png

 







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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ValtteriN
Super User
Super User

Hi,

Here is a measure for this:

To eur =
var _year = MAX('Table (39)'[Year])
var _currency = MAX('Table (38)'[Curency])
var _rate = CALCULATE(MAX('Table (39)'[Rate]),_currency='Table (39)'[From Currency],'Table (39)'[To Currency]="EUR")
RETURN
_rate*SUM('Table (38)'[Amount])


End result:
ValtteriN_0-1716799682048.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




HI ValtteriN,

 

many thanks for your help. i tried the measure that you created. seems the total amount is not correct. for example, if we choose 2024 as the year value , and total amount of sales is 364.90.  actually, the number should be 151.5(12.7+38.1+23.2+11+22+44.5)

 

sunyangjun1115_0-1716802696945.png

 

 

 

Hi,

Yes, sorry about that I forgot to fix the total calculation. 

To eur =
var _year = MAX('Table (39)'[Year])
var _vtable_rate = ADDCOLUMNS('Table (38)',"Rate",
var _currency = 'Table (38)'[Curency] RETURN
CALCULATE(MAX('Table (39)'[Rate]),_currency='Table (39)'[From Currency],'Table (39)'[To Currency]="EUR"))
RETURN

SUMX(_vtable_rate,
[Rate]*'Table (38)'[Amount])

Here I added SUMX and virtual table to account for empty filter context.
ValtteriN_0-1716818848062.png

 







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

Proud to be a Super User!




Hi ValtteriN, many thanks for your time and support. it works now. really appreciated .   

 

sunyangjun1115_0-1716896638077.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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