cancel
Showing results for 
Search instead for 
Did you mean: 

advanced formula step for calculation of dynamic measures

0 Kudos

I need to write advanced formula step for calculation of dynamic measures. We take useful life as counter input for FOR loop, then we do a calculation. But while writing back it should create columns(calculated measure) dynamically based on the counter.

FOREACH [d/Asset]
@Life = RESULTLOOKUP([d/Measures]="UsefulLife")
FOR @counter = 1 TO @Life
DATA([d/Measures] = "Depreciation",[d/Asset]=[d/Asset]) = RESULTLOOKUP([d/Measures]="TotalCost")/RESULTLOOKUP([d/Measures]="UsefulLife")
ENDFOR
ENDFOR

I get the following output.

vaishanavibashyam_0-1714638667392.png

But I need the following output for the column based on useful life.

vaishanavibashyam_1-1714638820601.png

 

 

 

View Entire Topic
N1kh1l
Active Contributor
0 Kudos

@vaishanavibashyam 

You cannot have measures dynamically created in Advanced Formula. All measures/accounts or any dimension master data should exist before Advance formula can post data. Advance Formula only creates/manipulates Fact data and not master data. 

For your requirement, Generally Asset depreciation happens over time so the straight line method of depreciation posts the depreciation amount across time periods. So you should be posting the depreciations across Date depending on Asset first use date and useful life. 

 

Hope this helps !!

Nikhil