Skip to main content
September 5, 2024
Solved

Scenario - Same value every year for specific account

  • September 5, 2024
  • 2 replies
  • 0 views

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

 

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

 

Best answer by vasantharaidu

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.
Test_Same value.jpg

 

 

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

 

 

2 replies

September 6, 2024

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

vasantharaiduAuthorAnswer
September 6, 2024

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.
Test_Same value.jpg

 

 

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