Forum Discussion
Currency Conversion Power Bi
- 3 years ago
You could do it as a measure like
USD Amount Measure = SUMX ( 'Transactions', VAR CurrencyRate = LOOKUPVALUE ( 'Exch rate'[rate], 'Exch Rate'[Date], DATE ( YEAR ( 'Transactions'[Transaction date] ), MONTH ( 'Transactions'[Transaction date] ), 1 ), 'Exch rate'[Currency], 'Transactions'[Currency] ) RETURN 'Transactions'[Amount] * CurrencyRate )but I think performance would likely be better having a calculated column and then building measures based on that. If it was a column then it would be calculated once, during data refresh, and then you could have measures to perform sum, average etc on the calculated column without having to pay the cost of all the lookups.
Best advice is to try both ways and use DAX Studio to compare performance
You could create a calculated column in the transactions table like
USD Amount =
VAR CurrencyRate =
LOOKUPVALUE (
'Exch rate'[rate],
'Exch Rate'[Date],
DATE ( YEAR ( 'Transactions'[Transaction date] ), MONTH ( 'Transactions'[Transaction date] ), 1 ),
'Exch rate'[Currency], 'Transactions'[Currency]
)
RETURN
'Transactions'[Amount] * CurrencyRate
- Anonymous3 years agoNot applicable
Hi John,
This did work. But i was wondering if instead of adding conditional column, there was a way to achieve this through dax measures.
Since i intend to add more factual transaction table and as far as i know measures are way better in terms of performance than calculated columns.
- johnt753 years agoSuper User
You could do it as a measure like
USD Amount Measure = SUMX ( 'Transactions', VAR CurrencyRate = LOOKUPVALUE ( 'Exch rate'[rate], 'Exch Rate'[Date], DATE ( YEAR ( 'Transactions'[Transaction date] ), MONTH ( 'Transactions'[Transaction date] ), 1 ), 'Exch rate'[Currency], 'Transactions'[Currency] ) RETURN 'Transactions'[Amount] * CurrencyRate )but I think performance would likely be better having a calculated column and then building measures based on that. If it was a column then it would be calculated once, during data refresh, and then you could have measures to perform sum, average etc on the calculated column without having to pay the cost of all the lookups.
Best advice is to try both ways and use DAX Studio to compare performance