Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Previous() ...again

Hi all,

today i am facing another challange trying to work with previous records.

here is what i have:

ProjectIDDateBudgetSpentTotalBudget
1112013-05-01050000
1112013-05-021000050000
1112013-05-031500050000
1112013-05-041200050000

I want to add another column to this table that gives me per day the [Remaining Budget]. Shold read something like this:

ProjectIDDateBudgetSpentTotalBudgetRemainingBudget
1112013-05-0105000050000
1112013-05-02100005000040000
1112013-05-03150005000025000
1112013-05-04120005000013000

I have multiple projects in this table and my idea was to

1. check if ProjectID = Previous(ProjectID)

2. if NO: take Total Budget - Budget Spent as RemainingBudget

3. if YES: take Previous(RemainingBudget) - BudgetSpent as Remaining Budget

But the LOAD fails, because the field RemainingBudget cannot be found in the NO condition of my if clause.

Any hint is much appreciated!

thanks!

K

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

Find attachment.. It will help u

View solution in original post

4 Replies
sujeetsingh
Master III
Master III

Hi,

I have tried to get output as you have shown in second Table

See the sample

tresesco
MVP
MVP

Could please share the exact code portion you are using?

Thanks.

sujeetsingh
Master III
Master III

Hi,

I am using the peek () and previous function with nested If() statement .

Not applicable
Author

Hi,

Find attachment.. It will help u