The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
Manjunathak
2 years agoNew Contributor III
Calculation based on time parameter
I have declared CurrYear and CurrMonth to retrive year and month respectively.
Dim CurrTime As String = api.Pov.Time.Name Dim CurrYear As Integer = TimeDimHelper.GetSubComponentsFromName(CurrTime)...
- 2 years ago
So, you want to run the calc2 in 2024 only up until 2024M5? Nothing to be calculated beyond 2024m5? in that case:
If CurrYear < 2024 then Calc1 else If CurrYear.Equals(2024) AndAlso CurrMonth <= 5 Then calc2 end if - 2 years ago
Hi, in case you are trying to set up a member formula, consider using the built-in functionality to vary the member formula by time (and / or scenario type).
Your pre-2024M5-calculation will be saved under "(Default Time)" and the post-2024M5-calculation will be saved in "2024M5". This will automatically apply the correct formula in the corresponding time periods.
If that is not within your considerations, you can also use these functions instead of using TimeDimHelpers:
Api.Time.GetYearFromId() Api.Time.GetPeriodNumFromId()If you need more time functions, please try to rely as much as possible on native functions. This is more future proof and easier to maintain and read. You can e.g. also use this to get the POV prior year:
Api.Time.GetYearFromId(Api.Time.GetPriorYearPeriodId())
Manjunathak
2 years agoNew Contributor III
Hi aformenti ,
thanks you're right,
can you also help me to break the calculation based on 2024M5?
if it is lease or equal 2024M5 run calc
If currYear < 2024 Then
Calc
Else If currYear = 2024 & currMonth <=5
Calc
End If
End If
the above code is not working for me
Henning
OneStream Employee
2 years agoHi, in case you are trying to set up a member formula, consider using the built-in functionality to vary the member formula by time (and / or scenario type).
Your pre-2024M5-calculation will be saved under "(Default Time)" and the post-2024M5-calculation will be saved in "2024M5". This will automatically apply the correct formula in the corresponding time periods.
If that is not within your considerations, you can also use these functions instead of using TimeDimHelpers:
Api.Time.GetYearFromId()
Api.Time.GetPeriodNumFromId()If you need more time functions, please try to rely as much as possible on native functions. This is more future proof and easier to maintain and read. You can e.g. also use this to get the POV prior year:
Api.Time.GetYearFromId(Api.Time.GetPriorYearPeriodId())
Related Content
- 2 years ago