Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tahsin12
Contributor II
Contributor II

Yearly Incentive Calculation in Data model

Hello there,

I'm new to qlikview development. I need help regarding a requirement. I give the requirements given below.Please help.

its a sales table

YearMonthVolume
2020110
2020220
2020330
2020440
2020550
2020660
2020770
2020880
2020990
202010100
202011110
202012120

 

 

now my required result for this table will be-

YearMonthVolumeIncentive
202011010
202022030
202033060
2020440100
2020550150
2020660210
2020770280
2020880360
2020990450
202010100550
202011110660
202012120780

 

the incentive field is the required result. The full calculation should be in qlikview script. I mean it's a back end calculation. Yearly cumulative calculation in qlikview script. Please help me out from this.

Regards

Tahsin12 

@hic @johnw 

Labels (4)
1 Solution

Accepted Solutions
Kushal_Chawda

@tahsin12  try below

Data:
LOAD Year, 
     Month, 
     Volume
FROM Source;

Final:
NoConcatenate
LOAD *,
     if(Year<>Previous(Year),Volume,rangesum(Peek(Incentive),Volume)) as Incentive
Resident Data
Order by Year,Month;

DROP Table Data;

View solution in original post

2 Replies
Kushal_Chawda

@tahsin12  try below

Data:
LOAD Year, 
     Month, 
     Volume
FROM Source;

Final:
NoConcatenate
LOAD *,
     if(Year<>Previous(Year),Volume,rangesum(Peek(Incentive),Volume)) as Incentive
Resident Data
Order by Year,Month;

DROP Table Data;
tahsin12
Contributor II
Contributor II
Author

Thanks a lot @Kushal_Chawda  it just perfectly worked.😊😊