a week ago
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).Year
Dim CurrMonth As Integer = TimeDimHelper.GetSubComponentNameFromName(currTime).Month
can you help me to retrieve month in CurrMonth?
Solved! Go to Solution.
a week 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
a week 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())
a week ago - last edited a week ago
Hi @Manjunathak ,
Sure, you can do this by using:
Dim CurrMonth As Integer = api.time.GetSubComponentsFromName(currTime).Month
a week ago
Hi @Manjunathak,
Just re-looking again at your initial code, your mistake was just an spelling issue:
TimeDimHelper.GetSubComponentsFromName(currTime).Month
a week ago
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
a week 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
a week 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())