I am creating a new calculated column called Final_Value in my calculated table called INDEX_1.
The condition is I have three columns called Kombi,JJJJ_MM, Value. Each kombi consists one row entry for each month starting from 12-2020, till 06-2024. The logic starts from December 2020. For that month the Final_Value is the same as Value. From the next month, if the value is 50% more than the Previous month’s Final_Value and the difference is greater than 1000,then change the current value to 1.5*Final_Value of last month.
if the value is 50% less than the Previous month’s Final_Value and the difference is less than -1000,then change the current value to 0.5*Final_Value of last month.
If the condition does not meet then keep the Current Value as Final_Value
I Tried the following code:
Final_Value =
VAR kombirow=[Kombi]
VAR curr_val=[Value]
VAR month_row=[JJJJ_MM]
VAR Prev_Val= MAXX(
FILTER(
Index_1,
[Kombi]==kombirow &&
[JJJJ_MM]== EDATE(month_row,-1)
),
[Final_Value]
)
VAR Difference= curr_val-Prev_Val
VAR Index_prev= Difference*100/Prev_Val
RETURN IF(
[JJJJ_MM]==DATE(2020,12,1),
curr_val,
(
IF(
Difference<-1000 && Index_prev<-50,
Prev_Val*0.5,
(
IF(
Difference>1000 && Index_prev>50,
Prev_Val*1.5,
curr_val
)
)
)
)
)
But I’m getting circular dependency error. If anyone have an alternate code, It would be of great help. Thanks in Advance.
Pramoth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.