Forum Discussion
Rdarshana
Helper II
1 year agoCurrency Conversion Data Model
Hi, I wanted to run the data model currency conversion for the group out here. This is what I have. The dimensions are all Dual Mode and Fact tables are Direct Query. Exchange Rates are ...
Anonymous
1 year agoNot applicable
Hi Rdarshana ,
According to your description, here are my steps you can follow as a solution.
(1) We can create a slicer table.
Slicer = DATATABLE (
"Currency", STRING,
{
{ "USD" },
{ "MKD" }
}
)
(2) We can create a measure.
Measure =
var _select_currency=SELECTEDVALUE('Slicer'[Currency])
var _rate=CALCULATE(SUM('Exchnage Rate table'[Rate]),FILTER(ALL('Exchnage Rate table'),MONTH([Rate Date])=MONTH(MAX('Fact 1'[Date])) && [From Currency]=MAX('Fact 1'[Currency Code])))
var _amount=SUM('Fact 1'[Amount])
RETURN IF(_select_currency=MAX('Fact 1'[Currency Code]),_amount,_rate* _amount)Measure 2 =
var _select_currency=SELECTEDVALUE('Slicer'[Currency])
var _rate=CALCULATE(SUM('Exchnage Rate table'[Rate]),FILTER(ALL('Exchnage Rate table'),MONTH([Rate Date])=MONTH(MAX('Fact 1'[Date])) && [From Currency]=MAX('Fact 2'[Currency Code])))
var _amount=SUM('Fact 2'[Amount])
RETURN IF(_select_currency=MAX('Fact 2'[Currency Code]),_amount,_rate* _amount)
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.