Forum Discussion
Calculated New Currency column based on two tables
- 2 years ago
Hi CanberkAcikbas ,
you can try the following code for a new calculated column in Table 1.
AmountEUR = VAR _XChangeRate = LOOKUPVALUE ( Table2[XChangeRate], Table2[COD1], Table1[Currency], Table2[Date], Table1[InvoiceDate] ) VAR _Result = IF ( Table1[Currency] = "EUR", Table1[Item], Table1[Item] * _XChangeRate ) RETURN _ResultBr
create relationship in your table and then try to use below dax:
NewColumn =
VAR CurrentCurrency = 'FirstTable'[Currency]
VAR ExchangeRate =
IF(
CurrentCurrency = "EUR",
1,
CALCULATE(
MAX('SecondTable'[EXCH_RATE]),
'SecondTable'[MON_UNIT_COD_1] = CurrentCurrency,
'SecondTable'[DAT_END] = 'FirstTable'[InvoiceDate]
)
)
RETURN
'FirstTable'[Value] * ExchangeRate
If this helped, Subscribe AnalyticPulse on YouTube for future updates:
https://www.youtube.com/@AnalyticPulse
https://instagram.com/analytic_pulse
https://analyticpulse.blogspot.com/
subscribe to Youtube channel For fun facts:
https://www.youtube.com/@CogniJourney
Thank you so much for your quick responses, it worked perfectly fine !
- AnalyticPulse2 years ago
Solution Sage
I dig a subscribe if you like my content. Shoot a sub to a channel @CogniJourney
Thanks.😊