Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
Hello,
I have 2 tables :
I want to find the latest Exchange Rate (ie the most recent) for my Transaction Currency and date in the EXCH_RATE table.
for example :
Transaction :
EXCH_RATE:
This should return, for TRANSACTION :
I tried several solutions (Calculate with filter, MAX, ...) But I can't manage to make it Work.
The last thing I tried :
TxChange = IF(TRANSACTION[CURRENCY] = "EUR";1;CALCULATE(MAX(EXCH_RATE[EXCH_RATE]);FILTER(EXCH_RATE;EXCH_RATE[DATE_FROM]=EARLIER(TRANSACTION[PAYMENT_DATE]));FILTER(EXCH_RATE;EXCH_RATE[CURRENCY] = TRANSACTION[CURRENCY])))
Thanks a lot for your help !
Julien
Solved! Go to Solution.
You may refer to the following DAX that adds a calculated column.
Column = IF ( 'TRANSACTION'[CURRENCY] = "EUR", 1, MAXX ( TOPN ( 1, FILTER ( EXCH_RATE, EXCH_RATE[CURRENCY] = 'TRANSACTION'[CURRENCY] && EXCH_RATE[DATE_FROM] <= 'TRANSACTION'[PAYMENT_DATE] ), EXCH_RATE[DATE_FROM], DESC ), EXCH_RATE[EXCH_RATE] ) )
You may refer to the following DAX that adds a calculated column.
Column = IF ( 'TRANSACTION'[CURRENCY] = "EUR", 1, MAXX ( TOPN ( 1, FILTER ( EXCH_RATE, EXCH_RATE[CURRENCY] = 'TRANSACTION'[CURRENCY] && EXCH_RATE[DATE_FROM] <= 'TRANSACTION'[PAYMENT_DATE] ), EXCH_RATE[DATE_FROM], DESC ), EXCH_RATE[EXCH_RATE] ) )
Hello,
Thanks for your replies.
I manages to do something with this expression :
TxChange = IF(TRANSACTION[CURRENCY] = "EUR";1;1/CALCULATE(SUM(EXCH_RATES[EXCH_RATE]);FILTER(EXCH_RATE;EXCH_RATES[DATE_FROM] = MAX(EXCH_RATES[DATE_FROM]));FILTER(EXCH_RATES;EXCH_RATES[CURRENCY]=TRANSACTION[CURRENCY])))
I don't know if it's really OK but I checked a dozen of lines and it's OK.
I didn't know TOPN Function ! It's exactly what I need for a lot of operations !!
Thanks a lot !
Try this calculated column in Transactions Table
= VAR LatestDate = CALCULATE ( MAX ( EXCH_RATE[DATE_FROM] ), FILTER ( EXCH_RATE, EXCH_RATE[CURRENCY] = 'TRANSACTION'[CURRENCY] ) ) RETURN CALCULATE ( VALUES ( EXCH_RATE[EXCH_RATE] ), FILTER ( EXCH_RATE, EXCH_RATE[CURRENCY] = 'TRANSACTION'[CURRENCY] && EXCH_RATE[DATE_FROM] = LatestDate ) )
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
65 | |
51 | |
45 |
User | Count |
---|---|
218 | |
88 | |
83 | |
65 | |
56 |