Forum Discussion

toBeTaughtIfPos's avatar
toBeTaughtIfPos
Frequent Visitor
1 year ago
Solved

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)

MarketKnown AsEvent DateCategoryCurrency pair (Functional-Contract)Movement typeDescriptionRate to useContract currency AmountRelevant FX RateFunctional Currency Amount
1JSA0334/1/2019ROU AssetJMD-USDAdditionTransition take upClosing153649.29134.35442720643462.32
1JSA0334/30/2019ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1202.58134.354427-161571.9468
1JSA0335/31/2019ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1242.66134.354427-166956.8723
1JSA0336/30/2019ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1202.58134.354427-161571.9468
1JSA0337/31/2019ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1242.66134.354427-166956.8723
1JSA0338/31/2019ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1242.66134.354427-166956.8723
1JSA0339/30/2019ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1202.58134.354427-161571.9468
1JSA03310/1/2019ROU AssetJMD-USDAdditionRemeasurement of Lease LiabilityClosing-3893.65135.153399-526240.032
1JSA03310/31/2019ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1209.59134.3325837-162487.3499
1JSA03311/30/2019ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1170.57134.3325837-157245.6925
1JSA03312/31/2019ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1209.59134.3325837-162487.3499
1JSA0331/31/2020ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1209.59134.3325837-162487.3499
1JSA0332/29/2020ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1131.56134.3325837-152005.3784
1JSA0333/31/2020ROU AssetJMD-USDDepreciation ChargeRight of Use Asset depreciationBlended Historic Closing-1209.59134.3325837-162487.3499

and Table2: Lookup_FX_Rates_table

Currency Rate TypeCurrency PairPeriodValue
CurrentJMD-USD4/30/2019134.354427
CurrentJMD-USD5/31/2019136.351241
CurrentJMD-USD6/30/2019134.048257
CurrentJMD-USD7/31/2019127.991809
CurrentJMD-USD8/31/2019126.871352
CurrentJMD-USD9/30/2019126.807
CurrentJMD-USD10/31/2019135.153399
CurrentJMD-USD11/30/2019128.205128
CurrentJMD-USD12/31/2019125.015627
CurrentJMD-USD1/31/2020133.74348
CurrentJMD-USD2/29/2020132.766861
CurrentJMD-USD3/31/2020130.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

  • 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?

     

     

    • toBeTaughtIfPos's avatar
      toBeTaughtIfPos
      Frequent 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's avatar
        lbendlin
        Icon for Super User rankSuper User

        I'm still not following. What's the formula in cell K10 ?

         

        Can you maybe post the Excel file?

  • v-prasare's avatar
    v-prasare
    Icon for Community Support rankCommunity 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's avatar
    v-prasare
    Icon for Community Support rankCommunity 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's avatar
    v-prasare
    Icon for Community Support rankCommunity 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"

    • toBeTaughtIfPos's avatar
      toBeTaughtIfPos
      Frequent 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's avatar
    v-prasare
    Icon for Community Support rankCommunity 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.