Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
This is what I'm trying to achieve:
Using current exchange rate for balances (aka. Running Totals, Cumulative Total) in periods that may not have entries.
Basic example:
Exchange Rates: USD->GBP
January: 0.75
February: 0.76
March: 0.8
I deposit 1000 USD in my back account in January worth 750 GBP (1000 * 0.75). No further entries.
End of March the account balance is still 1000 USD but it's now worth 800 GBP (1000 * 0.80) based on latest exchange rate.
In my attempts with DAX I keep getting the balance to: 750 GBP rather than 800 GBP.
My real life scenario involves an enterprise that owns multiple businesses across the world with different functional currencies and needs to provide consolidated financial statements (income statements & balance sheets).
So we have a transaction currency and reporting currency.
My test data model is identical to Kasper's example: https://www.kasperonbi.com/currency-conversion-in-dax-for-power-bi-and-ssas/
Except I have a DimDate table instead of "ExchangeDate" and I've replaced his "FactSales" with a "General Ledger" alongside new dummy data.
I have 3 measures:
TrnExchangeRate =
VAR selectedCurrency = SELECTEDVALUE(ReportingCurrency[CurrencyCode];"USD")
RETURN
CALCULATE(Min(ExchangeRates[ExchangeRate]);FILTER(ExchangeRates;ExchangeRates[ReportCurrency]=selectedCurrency))
PostingAmount = SUMX('General Ledger'; [PostingAmount_LCY] * [TrnExchangeRate])
PostingAmount Balance =
IF (
MIN ( 'Calendar'[Date] )
<= CALCULATE ( MAX ( 'General Ledger'[PostingDate] ); ALL ('General Ledger' ) );
CALCULATE (
[PostingAmount];
FILTER (
ALL ( 'Calendar'[Date] );
'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
)
)
)
Above DAX provides the correct currency conversion for entries. But balances reflects the exchange rate based on the PostingDate and not the current date in filter context.
In below example I've hard-coded exchange rates of: 3, 4 and 5 for Oct, Nov and Dec respectively.
In the first table you can see, the "PostingAmount" is converting the amounts correctly for entries.
In the second table, I'm filtering on "Cash On Hand", and you can see the balance is 300 (100 * 3) for November and December whereas I wanted that to be 400 (100 * 4) and 500 (100 * 5).
I hope above is sufficient details to assist me? This is my first post. I couldn't seem to upload the PBIX file with my dummy example.
Thanks!
Solved! Go to Solution.
This ended up supplying the solution:
I combined the data model from: https://www.kasperonbi.com/currency-conversion-in-dax-for-power-bi-and-ssas/
With the measure definition from accepted solution: https://community.powerbi.com/t5/Desktop/Running-Total-multiple-currency-conversion-to-one/m-p/14099...
Thank you for your assistance @v-chuncz-msft
This ended up supplying the solution:
I combined the data model from: https://www.kasperonbi.com/currency-conversion-in-dax-for-power-bi-and-ssas/
With the measure definition from accepted solution: https://community.powerbi.com/t5/Desktop/Running-Total-multiple-currency-conversion-to-one/m-p/14099...
Thank you for your assistance @v-chuncz-msft
You may check if the post below helps.
https://community.powerbi.com/t5/Desktop/Find-last-value-based-on-date/m-p/293150#M129228
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |