Forum Discussion

Spalomino's avatar
Spalomino
New Contributor II
2 years ago

datacalculate help

Dear Community:

I am trying to add a previous year M12 balance to a SCF report.  I can't seem to get prior year data to come over.  However, If I code the amount it does work.

' api.Data.calculate("A#CF_RepaymentEquityInvestment = A#CF_RepaymentEquityInvestment + A#33100:T#POVPriorYearM12") does not work

' api.Data.calculate("A#CF_RepaymentEquityInvestment = A#CF_RepaymentEquityInvestment + A#33100:T#2022M12") does not work

' api.Data.calculate("A#CF_RepaymentEquityInvestment = A#CF_RepaymentEquityInvestment + A#33100") does not work

api.Data.calculate("A#CF_RepaymentEquityInvestment = A#CF_RepaymentEquityInvestment + -62225") ' Returns amount as intended

 

Thanks

  • NicolasArgente's avatar
    NicolasArgente
    Valued Contributor

    Hi Spalomino 
    The value you have of 62225, can  you see it in your cuve view? Did you right click on its cell and analysed the cell POV and all its intersection? Did you do the same for A#CF_RepaymentEquityInvestment?

    • Spalomino's avatar
      Spalomino
      New Contributor II

      Nicolas:  Thanks for responding.  Yes, the data [$62,225] is sitting our cube.

      • NicolasArgente's avatar
        NicolasArgente
        Valued Contributor

        can you paste here the cell POV intersections for us to see? Did you try to add it this directly in the formulae? 

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    You have to remember that, when using Calculate, you're working with databuffers, not single cells like in GetDataCell. The dimensionality of databuffers has to match, so things like your first attempt are a non-starter: one buffer only has Account specified, and the other has Account and Time.

    If you balance the buffer dimensionality, it should work:

    api.Data.calculate("A#CF_RepaymentEquityInvestment = A#CF_RepaymentEquityInvestment:T#Pov + A#33100:T#PovPriorYear12")

    If not, you should investigate what those buffers actually contain, i.e. if you're ever going to have values in the same intersections on both sides. Check out GetDataBufferUsingFormula and LogDataBuffer for that.

    • Spalomino's avatar
      Spalomino
      New Contributor II

      Jack:

      Thanks for the information.  I will pursue the GetDataBuffer and LogDataBuffer approach.  

      Best