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

Announcements
Join us at Qlik Connect 2026 in Orlando, April 13–15: Register Here!
cancel
Showing results for 
Search instead for 
Did you mean: 
profilejamesbond
Creator II
Creator II

Qlik Sense - Straight Table - Restart RowNumber from 1 to x for each row

Hi,

I have straight table in the Qlik SaaS (Sense) where I have number of dimensions and one expression such as

Sum(Sales).

Now, the problem is where there is duplicate then Qlik only shows one Sum while there are more rows with the same key.

For example

id, data, sales

01, 24.02.2026, 100

01, 24.02.2026, 100

01, 24.02.2026, 100

02, 24.02.2026, 100
02, 24.02.2026, 100

etc

Now, Qlik Shows only one rows and Qlik Enginee supress the values. 

I want to show the row number for each group of rows.

id, data, sales, rownumber

01, 24.02.2026, 100, 1

01, 24.02.2026, 100, 2

01, 24.02.2026, 100, 3

01, 24.02.2026, 100, 4

02, 24.02.2026, 100, 1

02, 24.02.2026, 100, 2

 

I am using this expression but the problem is it shows me in thousands the rownumbers while I want to restart the rownumber everytime for each new data

=Aggr(RowNo(TOTAL), key)

 

Thanks

Labels (3)
2 Replies
talebmakrani2
Contributor
Contributor

I hope this should work.

RawData:
LOAD
id,
Date(Date#(data,'DD.MM.YYYY')) AS data, // parse to date (optional)
Num(sales) AS sales
INLINE [
id, data, sales
01, 24.02.2026, 100
01, 24.02.2026, 100
01, 24.02.2026, 100
02, 24.02.2026, 100
02, 24.02.2026, 100
];


NoConcatenate
SortedData:
LOAD *
RESIDENT RawData
ORDER BY id, data, sales; 


WithCounter:
LOAD
id,
data,
sales,
If(id = Peek('id') and data = Peek('data') and sales = Peek('sales'),
Peek('RowCounter') + 1,
1
) AS RowCounter
RESIDENT SortedData
ORDER BY id, data, sales;


FinalTable:
NOCONCATENATE
LOAD *
RESIDENT WithCounter;

DROP TABLE RawData;
DROP TABLE SortedData;
DROP TABLE WithCounter;

Qrishna
Master
Master

Data:
Load RecNo() as RowID,
If(id = Peek(id) and date = Peek(date), Peek(GroupRowID) + 1, 1) AS GroupRowID,
//If(id = Peek(id) and date = Peek(date) and sales = Peek(sales), Peek(GroupRowID) + 1, 1) AS GroupRowID, // Use this if you want to consider sales too, as different group
*;
Load * Inline [
id, date, sales
01, 24.02.2026, 100
01, 24.02.2026, 100
01, 24.02.2026, 100
01, 24.02.2026, 100
02, 24.02.2026, 100
02, 24.02.2026, 100
02, 24.02.2026, 200
]
;

 

2543593 - RowNumber from 1 to x for each row.PNG