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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JosefinR
New Member

Average exchange rate

I have a table with an exchange rate that converts the companies' local currency to SEK. The exchange rate is available per day and sales transaction. See table 1 for what that table looks like. I also have a table with budget figures, see table 2. I want to calculate an average value for the exchange rate per month and company and multiply by the budget figures for that month and for that company.

Tabel 1

DateYearMonthCompanyKeyExchange Rate LCY To SEK
2024-01-02 00:00jan-24Company A1.49622
2024-01-02 00:00jan-24Company B0.98874
2024-01-02 00:00jan-24Company D11.1545
2024-01-02 00:00jan-24Company C1
2024-01-03 00:00jan-24Company A1.50058
2024-01-03 00:00jan-24Company D11.1915
2024-01-04 00:00jan-24Company A1.50027


Table 2

Budget   
DateSalesRepCompanyBudget
24-jan4Company D1000
24-feb5Company B2000


The budget is made per seller and the transaction where I get the Exchange rate from is per order/sales line.

I've tried the following but can't get it to work because when I bring in salespeople as a hierarchy in a matrix table, it can't find a value for the exchange rate for that salesperson since that salesperson has no sales row. I would like to remove the dependency to everything except company and month and get a fixed value per month and company regardless of whether I want to break it down by salesperson, team or something else.


VAR AVExhange= CALCULATE(AVERAGEX('ExchangeTable', [Exchange Rate LCY To SEK]),USERELATIONSHIP('ExchangeTable'[CompanyKey],Company[CompanyKey]))
VAR BudgetInSEK = CALCULATE('Budget measures'[Budget LCY],USERELATIONSHIP(Budget[CompanyKey],Company[CompanyKey]))

RETURN
BudgetInSEK*AVExhange

Thank you for your help!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @JosefinR ,

 

You can try the following dax:

Measure =
var AVExhange=
AVERAGEX(
    FILTER(ALL(ExchangeTable),
    'ExchangeTable'[CompanyKey]=MAX('Company'[Company Key])),[Exchange Rate LCY To SEK])
var BudgetInSEK=
SUMX(
    FILTER(ALL('Budget'),
    'Budget'[Company Key]=MAX('Company'[Company Key])),'Budget measures'[Budget LCY])
return
BudgetInSEK*AVExhange

If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @JosefinR ,

 

You can try the following dax:

Measure =
var AVExhange=
AVERAGEX(
    FILTER(ALL(ExchangeTable),
    'ExchangeTable'[CompanyKey]=MAX('Company'[Company Key])),[Exchange Rate LCY To SEK])
var BudgetInSEK=
SUMX(
    FILTER(ALL('Budget'),
    'Budget'[Company Key]=MAX('Company'[Company Key])),'Budget measures'[Budget LCY])
return
BudgetInSEK*AVExhange

If it doesn't meet your desired outcome, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@JosefinR Use ALLEXCEPT or REMOVEFILTERS.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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