Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Replicating Excel formula in QV.

Hi All,

we are having a requirement given below (also attached the excel). Looks pretty straight forward in excel but difficult to replicate in QlikView.

The values in the column "CarryForward" needs to be taken from previous month of "Final" for the corresponding Team and this value needs to be used in the Final again. (Final = CarryForward + Amount).

We are unable to bring the previous value in the Final to the CarryForward.

Please let us know if you need any more details.

MonthTeamCarryForwardAmountFinal
1Team10100100
1Team20260260
2Team1100500600
2Team2260240500
3Team16005801180
3Team25005661066

Thanks,
Sijo Joseph

6 Replies
datanibbler
Champion
Champion

Hi,

in QlikView there is the PEEK() function - or PREVIOUS().

Both of these functions let you populate one record with a value from the previously read record (the one above if you have it sorted by month).

HTH

Best regards,

DataNibbler

MK_QSL
MVP
MVP

Provide proper sample data... we would work for your expected result...

kuba_michalik
Partner - Specialist
Partner - Specialist

Is that supposed to be done in script, or in the frontend (a straigtht chart for example)?

Not applicable
Author

Check out the QVW attached.

Load Script:

Raw:

LOAD * INLINE [

    Month, Team, Amount

    1, Team1, 100

    1, Team2, 260

    2, Team1, 500

    2, Team2, 240

    3, Team1, 580

    3, Team2, 566

];

Final:

Load

  Month,

  Team,

  Amount,

  If(Team = Previous(Team) and Month = Previous(Month)+1, Previous(Amount), 0) as CarryForward,

  If(Team = Previous(Team) and Month = Previous(Month)+1, Previous(Amount), 0) + Amount as Final

Resident Raw

Order by Team asc,Month asc;

Drop table Raw;

Not applicable
Author

Hi All,

We need this to be done in the front end, ie a pivot table or straight table.

Thanks,

Sijo

Not applicable
Author

Hi All,

We need this to be done in the front end, ie a pivot table or straight table.

Thanks,

Sijo