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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
spjuza
Contributor III
Contributor III

Create incremental variable in load script.

I'm trying to create a variable in my load script to determine which nth bucket something falls into.  For example, my table is currently like this:

 

Project|Day|Phase|Number of Days in Phase|Day Number|

Project1|1/1/2023|Development|30|1

Project1|1/2/2023|Development|30|2

Project1|1/3/2023|Development|30|3

Project1|1/4/2023|Development|30|4

....

Project1|1/31/2023|Production|100|1

Project1|2/1/2023|Production|100|2

...

Project2|3/15/2023|Development|15|1

Project2|3/16/2023|Development|15|2

Etc.

 

The other columns are either in my database I'm pulling information from, but I'm not sure how to best calculate the final column.  Thanks!

Labels (1)
1 Solution

Accepted Solutions
spjuza
Contributor III
Contributor III
Author

Got it to work:  Here's the final result that worked

 

IF(Project=Peek(Project) and [Phase] = peek([Phase]) ,

peek(DayNumberOfPhase1)+1,1) as DayNumberOfPhase1

 

It also requires ordering the table based on project and date. 

View solution in original post

3 Replies
Chanty4u
MVP
MVP

Try this

    AutoNumber(Phase & '|' & Project) as [Day Number]

 

spjuza
Contributor III
Contributor III
Author

This didn't work, it counted every day in the phase + project as 1, then the next phase as 2, etc., so it looked like this:

Project1|1/1/2023|Development|30|1

Project1|1/2/2023|Development|30|1

Project1|1/3/2023|Development|30|1

Project1|1/4/2023|Development|30|1

....

Project1|1/31/2023|Production|100|2

Project1|2/1/2023|Production|100|2

...

Project2|3/15/2023|Development|15|3

Project2|3/16/2023|Development|15|3

 

spjuza
Contributor III
Contributor III
Author

Got it to work:  Here's the final result that worked

 

IF(Project=Peek(Project) and [Phase] = peek([Phase]) ,

peek(DayNumberOfPhase1)+1,1) as DayNumberOfPhase1

 

It also requires ordering the table based on project and date.