Forum Discussion

vasantharaidu's avatar
vasantharaidu
New Contributor II
4 months ago

Scenario - Same value every year for specific account

Hi Guys,

We got a request from user to get data from 2023M12 from actual scenario to forecast scenario.

for Balace sheet accounts, the value from 2023M12 to be same till 2024M12 for specific account. 

Can anyone help me to find way to retain same value for BS account, i have tried but due to activity calculation and endbalance input value, the value become zero for all the months.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

If Not api.Entity.HasChildren() AndAlso (api.Cons.IsLocalCurrencyForEntity()) Then
Api.Data.Calculate("S#FCST_6_6_Test_Same_value:A#121010:V#YTD:T#2024M1:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#2023M12:O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None")
End If

If Not api.Entity.HasChildren() AndAlso (api.Cons.IsLocalCurrencyForEntity()) Then
Api.Data.Calculate("S#FCST_6_6_Test_Same_value:A#121010:V#YTD:T#2024M1:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#2023M12:O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None")
End If

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

  • Hi Eric,

    Appreciated for your help, but this code not giving the output what we needed. also i tried with simple code to get last year number to this year. Finally i got the expected value in all the period.

     

     

    Dim curTimeId As Integer = api.Pov.Time.MemberId
    Dim lastPerPYId As Integer = api.Time.GetLastPeriodInPriorYear(curTimeId)
    Dim lastPerPY As String = api.Time.GetNameFromId(lastPerPYId)
    Dim curYear As String = api.Time.GetNameFromId(api.Time.GetYearFromId(curTimeId))
    
    If (Not api.Entity.HasChildren()) Then 'AndAlso api.Cons.IsLocalCurrencyForEntity() AndAlso api.pov.Scenario.Name.XFEqualsIgnoreCase("FCST_6_6_Test_Same_value") AndAlso curYear.XFEqualsIgnoreCase("2024") Then
        ' No need to redeclare lastPerPY here, reuse it
        lastPerPY = api.Time.GetNameFromId(lastPerPYId)
    
        Api.Data.Calculate("A#121010:V#YTD:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U7#GL_Load:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#" & lastPerPY & ":O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U7#Top:U8#None")
    End If

     

     

  • EricOsmanski's avatar
    EricOsmanski
    Valued Contributor

    This is untested, but should get you what you need:

    Dim curTimeId As Integer = api.Pov.Time.MemberId
    Dim lastPerPYId As Integer = api.Time.GetLastPeriodInPriorYear(curTimeId)
    Dim lastPerPY As String = api.Time.GetNameFromId(lastPerPYId)
    Dim curYear As String = api.Time.GetNameFromId(api.Time.GetYearFromId(curTimeId))

    If (Not api.Entity.HasChildren()) AndAlso api.Cons.IsLocalCurrencyForEntity() AndAlso api.pov.Scenario.Name.XFEqualsIgnoreCase("FCST_6_6_Test_Same_value") AndAlso curYear.XFEqualsIgnoreCase("2024") Then
    Api.Data.Calculate("A#121010:V#YTD:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#" & lastPerPY & ":O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U8#None")
    End If

  • vasantharaidu's avatar
    vasantharaidu
    New Contributor II

    Hi Eric,

    Appreciated for your help, but this code not giving the output what we needed. also i tried with simple code to get last year number to this year. Finally i got the expected value in all the period.

     

     

    Dim curTimeId As Integer = api.Pov.Time.MemberId
    Dim lastPerPYId As Integer = api.Time.GetLastPeriodInPriorYear(curTimeId)
    Dim lastPerPY As String = api.Time.GetNameFromId(lastPerPYId)
    Dim curYear As String = api.Time.GetNameFromId(api.Time.GetYearFromId(curTimeId))
    
    If (Not api.Entity.HasChildren()) Then 'AndAlso api.Cons.IsLocalCurrencyForEntity() AndAlso api.pov.Scenario.Name.XFEqualsIgnoreCase("FCST_6_6_Test_Same_value") AndAlso curYear.XFEqualsIgnoreCase("2024") Then
        ' No need to redeclare lastPerPY here, reuse it
        lastPerPY = api.Time.GetNameFromId(lastPerPYId)
    
        Api.Data.Calculate("A#121010:V#YTD:O#Import:U2#None:U3#None:U4#None:U5#None:U6#None:U7#GL_Load:U8#None = S#Actual_Proforma:A#121010:V#YTD:T#" & lastPerPY & ":O#Top:U2#None:U3#None:U4#None:U5#None:U6#None:U7#Top:U8#None")
    End If