Forum Discussion

Mustafa_A's avatar
Mustafa_A
Contributor II
3 years ago

Prior/Current Month Dynamic Calculation

Good morning All,

How do I make build this dynamic calculation for my Monthly Rate KPI CV?  It takes the new month and divides it by the previous trailing month (e.g. Jan-21/Dec-20, Feb-21/Jan-21....)

 

Here is the code I wrote:

Dim RentalRevenue As Decimal = api.Data.GetDataCell("A#NetIncome:U4#[Rental Revenue]").CellAmount

Dim RentalRevenueTrailing1Mo As Decimal = api.Data.GetDataCell("A#NetIncome:U4#[Rental Revenue].Prior1").CellAmount

Return RentalRevenue/RentalRevenueTrailing1Mo

 

Any ideas will be appreciated. Thank you.

 

Best,

Mustafa A

 

  • No response needed. I figured it out.

    Needed to add "POVPrior1Month" to gab the prior period. Here is the modified code

    Dim RentalRevenue As Decimal = api.Data.GetDataCell("A#NetIncome:U4#[Rental Revenue]:S#Actual").CellAmount
    Dim RentalRevenueTrailing1Mo As Decimal = api.Data.GetDataCell("A#NetIncome:U4#[Rental Revenue]:S#Actual:T#POVPrior1").CellAmount

    Return RentalRevenue/RentalRevenueTrailing1Mo - 1

  • Mustafa_A's avatar
    Mustafa_A
    Contributor II

    No response needed. I figured it out.

    Needed to add "POVPrior1Month" to gab the prior period. Here is the modified code

    Dim RentalRevenue As Decimal = api.Data.GetDataCell("A#NetIncome:U4#[Rental Revenue]:S#Actual").CellAmount
    Dim RentalRevenueTrailing1Mo As Decimal = api.Data.GetDataCell("A#NetIncome:U4#[Rental Revenue]:S#Actual:T#POVPrior1").CellAmount

    Return RentalRevenue/RentalRevenueTrailing1Mo - 1