Forum Discussion
Historic Blended Fx rate - column self referencing help
Hi all,
First post, happy new year, and apologies if I miss critical info, appreciate anybody that tries to help with the mess below 😅.
Situation: Accounting for Leases in non-functional currency.
I'm trying to create a powerBI model, that takes accounting journals that are presented in a contract's currency, and will convert these to the appropriate functional currency value for the month in question. I created a model last year, that broadly did what I needed it to, but had trouble with my depreciation charge because I needed to calculate a blended FX rate in a calcualted colum that would allow the posted functional NBV to be depreciated to zero. This meant I was referencing the column I was trying to write a formula in to try and get the previous row's values for it - and PBI didn't like a calc'd column that was self referencing. I ended up doing a work around that was materially correct, but not right, which I am trying to remedy now.
Looking to understand if what I am looking to do is possible, and the best way to do this - I think probably in M code hence posting in this formum, or either a calc'd column or measure.
Ultimately, I will use the functional currency amounts in an aggregation to create subledgers by lease and identify what journals need to be posted each month. Would like to be able to publish this so it is accessible to people from the different markets and functions which I why I'm trying it in PBI, and I'm not familiar with other tools (SQL/Python etc) unfortunately - so if PBI isn't the one, I may have to accept the ideal solution isn't possible.
Assume I have two tables:
Table1: Data_Journals (please ignore the rightmost two column for now - these are what I want to add and are referred to below, but included here to save space/repetition)
| Market | Known As | Event Date | Category | Currency pair (Functional-Contract) | Movement type | Description | Rate to use | Contract currency Amount | Relevant FX Rate | Functional Currency Amount |
| 1 | JSA033 | 4/1/2019 | ROU Asset | JMD-USD | Addition | Transition take up | Closing | 153649.29 | 134.354427 | 20643462.32 |
| 1 | JSA033 | 4/30/2019 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1202.58 | 134.354427 | -161571.9468 |
| 1 | JSA033 | 5/31/2019 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1242.66 | 134.354427 | -166956.8723 |
| 1 | JSA033 | 6/30/2019 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1202.58 | 134.354427 | -161571.9468 |
| 1 | JSA033 | 7/31/2019 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1242.66 | 134.354427 | -166956.8723 |
| 1 | JSA033 | 8/31/2019 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1242.66 | 134.354427 | -166956.8723 |
| 1 | JSA033 | 9/30/2019 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1202.58 | 134.354427 | -161571.9468 |
| 1 | JSA033 | 10/1/2019 | ROU Asset | JMD-USD | Addition | Remeasurement of Lease Liability | Closing | -3893.65 | 135.153399 | -526240.032 |
| 1 | JSA033 | 10/31/2019 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1209.59 | 134.3325837 | -162487.3499 |
| 1 | JSA033 | 11/30/2019 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1170.57 | 134.3325837 | -157245.6925 |
| 1 | JSA033 | 12/31/2019 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1209.59 | 134.3325837 | -162487.3499 |
| 1 | JSA033 | 1/31/2020 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1209.59 | 134.3325837 | -162487.3499 |
| 1 | JSA033 | 2/29/2020 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1131.56 | 134.3325837 | -152005.3784 |
| 1 | JSA033 | 3/31/2020 | ROU Asset | JMD-USD | Depreciation Charge | Right of Use Asset depreciation | Blended Historic Closing | -1209.59 | 134.3325837 | -162487.3499 |
and Table2: Lookup_FX_Rates_table
| Currency Rate Type | Currency Pair | Period | Value |
| Current | JMD-USD | 4/30/2019 | 134.354427 |
| Current | JMD-USD | 5/31/2019 | 136.351241 |
| Current | JMD-USD | 6/30/2019 | 134.048257 |
| Current | JMD-USD | 7/31/2019 | 127.991809 |
| Current | JMD-USD | 8/31/2019 | 126.871352 |
| Current | JMD-USD | 9/30/2019 | 126.807 |
| Current | JMD-USD | 10/31/2019 | 135.153399 |
| Current | JMD-USD | 11/30/2019 | 128.205128 |
| Current | JMD-USD | 12/31/2019 | 125.015627 |
| Current | JMD-USD | 1/31/2020 | 133.74348 |
| Current | JMD-USD | 2/29/2020 | 132.766861 |
| Current | JMD-USD | 3/31/2020 | 130.514226 |
In my PBI, there is a calendar table that creates the relationship between the event date from table1 and that month's closing fx rate in table2 using an end of month column in the calendar table.
In excel on a small scale with this data I can easily add the two columns I need to Data_Journals to calc the functional currency amounts needed (see the rightmost two columns in Table1 above). Where my formulas in those two columns are essentially (being the formulas in the top row which is dragged down):
- Relevant FX Rate=IF(I2="Closing",SUMIFS(Lookup_FX_Rates_table!$E$2:$E$13,Lookup_FX_Rates_table!$C$2:$C$13,Data_Journals!F2,Lookup_FX_Rates_table!$D$2:$D$13,EOMONTH(Data_Journals!C2,0)),SUM($L$1:L1)/SUM($J$1:J1))
- Functional Currency Amount=J2*K2
I am looking for the best solution for how to get the same result in PBI. It would need to be scalable - as I have a large number of journals, and it would be a part of that column, as the extract I have showed is just for ROU, I will have other lines with different categories that I am comfortable pulling the correct fx rate for to use in the calc within a calc'd column.
Incase the solution is in M, then essentially the column "Rate-to-use" defines which I need, either the closing for the currency pair, the average where both closing and average are specified already in the Lookup_FX_Rates_table - or the calculated blended historic closing which would be unique for each non functional currency lease.
Previously for closing and average, I had a separate table for each, Lookup_FX_Rates_table_Average & Lookup_FX_Rates_table_Closing, but I might try making just one table now if it is easier/cleaner.
Very sorry if this is unclear, if more info is required, I will try to share as best I can. Thanks in advance all.
Edit: Link to excel file:
PowerQuery Forum Help file - Blended historic FX rate.xlsx
Hi v-prasare, thanks for following up - I had to step away from this project briefly, but coming back to this now. appreciate your help to try and get a successful solution!
17 Replies
- lbendlin
Super User
Self referencing will never be possible in DAX. In Power Query you can sometimes emulate it with List.Accumulate.
How is 134.3325837 calculated? Average of what?
- toBeTaughtIfPosFrequent Visitor
Hey, Thanks for the reply.
Great question, hopefully the below picture better shows it, I simplified the formula from the post to make it clearer for the screenshot.
- lbendlin
Super User
I'm still not following. What's the formula in cell K10 ?
Can you maybe post the Excel file?
- v-prasare
Community Support
Hi toBeTaughtIfPos,
Hope your doing well.
lbendlin Thanks for your prompt response here.
toBeTaughtIfPos, as we haven’t heard back from you, we wanted to check in to see if the resolution provided by our Supers User helps?
If you’re still facing any issues or have additional questions, please don’t hesitate to let us know.
We’re here to help and would be happy to assist further if needed. Looking forward to your feedback!
Thanks,
Prashanth Are
MS Fabric community support.
Did we answer your question? Mark post as a solution, this will help others!
If our response(s) assisted you in any way, don't forget to drop me a "Kudos"
- v-prasare
Community Support
toBeTaughtIfPos, as we haven’t heard back from you, we wanted to check in to see if the resolution provided by our Supers User helps?
If you’re still facing any issues or have additional questions, please don’t hesitate to let us know.
We’re here to help and would be happy to assist further if needed. Looking forward to your feedback!
Thanks,
Prashanth Are
MS Fabric community support.
Did we answer your question? Mark post as a solution, this will help others!
If our response(s) assisted you in any way, don't forget to drop me a "Kudos"
- v-prasare
Community Support
@toBeTaughtIfPos, as we haven’t heard back from you, we wanted to check in to see if the resolution provided by our Supers User helps?
If you’re still facing any issues or have additional questions, please don’t hesitate to let us know.
We’re here to help and would be happy to assist further if needed. Looking forward to your feedback!
Thanks,
Prashanth Are
MS Fabric community support.
Did we answer your question? Mark post as a solution, this will help others!
If our response(s) assisted you in any way, don't forget to drop me a "Kudos"
- toBeTaughtIfPosFrequent Visitor
Hi v-prasare, thanks for following up - I had to step away from this project briefly, but coming back to this now. appreciate your help to try and get a successful solution!
- v-prasare
Community Support
Thanks for the update toBeTaughtIfPos
- v-prasare
Community Support
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
If we don’t hear back, we’ll go ahead and close this thread. For any further discussions or questions, please start a new thread in the Microsoft Fabric Community Forum we’ll be happy to assist.
Thank you for being part of the Microsoft Fabric Community.