Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
laurenwagner
Contributor
Contributor

Repeating value in a flat table based on the sum of another value in the script

Looking for some help with repeating a specific value. What I need is for [Item ID] to repeat in the table as many times as the sum of CountOrderItemIDs.

This is a very simplistic view of how my data is currently set up:

laurenwagner_0-1666045493620.png

[Load2]:
load distinct
[Item ID],
[Store-ReviewCategory],
CountOrderItemIDs
resident [Load1];

But this is how I need the data to be coming through:

laurenwagner_1-1666045637186.png

**This is an example data set. The actual data set has thousands of unique Item IDs with much large CountOrderID sums, so I would need something that can be automated on a large set of data.

 

Labels (2)
1 Reply
vinieme12
Champion III
Champion III

As below

temp:
Load ID,Cat,numfield inline [
ID,Cat,numfield
50356,Shirt,2
2321,Pant,4
242342,Shoes,1
234,Hats,4
98789,Purses,5
];

 

Main:
Load
ID,Cat,numfield
,IterNo() as Rank
Resident temp
while IterNo()<=numfield
;

drop table temp;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.