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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
rogeriobarbosa
Contributor II
Contributor II

REGISTRATION COUNTER

NEED TO CREATE AN ACCOUNTANT IN USING Rowno SCRIP (), COUNT TO RESTART THE NEXT DAY FOLLOWING THE EXAMPLE.

DAY SALES COUNTER

1      100           1

1      200           2

1      400           3

2      800           1

2      800           2

3      400           1

3      500           2

THANKS

Labels (1)
1 Reply
richard_pearce6
Partner - Specialist
Partner - Specialist

Hi, try this code:

sales_temp:
LOAD * Inline [
DAY, SALES
1,      100,   
1,      200,          
1,      400,        
2,      800,          
2,      800,        
3,      400,        
3,      500,         
];

// Find the first and last dates

temp_min_max:
LOAD min(DAY) as minDay
  ,max(DAY) as maxDay
Resident sales_temp;


LET sVar_MinDay = peek('minDay',0,'temp_min_max');
LET sVar_MaxDay = peek('maxDay',0,'temp_min_max');

drop table temp_min_max;

LET sVar_RowMinus = 0;

// Loop through the dates, presume there are no missing dates but I don't think that will cause a problem

for sVar_DayStep = sVar_MinDay to sVar_MaxDay

      Sales:
        LOAD *
        ,RowNo()-$(sVar_RowMinus) as Step
      Resident sales_temp
      where DAY = $(sVar_DayStep);

      Let sVar_RowMinus = NoOfRows('Sales');

next sVar_DayStep

drop table sales_temp;