Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
evgeniystuchalk
Partner
Partner

Create multiple records from single line

Hello! I have table with payments. Like:

7cd818a228.jpg

I want to generate additional table during load, where for each Deal I have record for each month that included in Pack. Like:

7cc495972e.jpg

To make this connection:

9ae8e5d24f.jpg

How I can do it?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Something like

LOAD [Deal ID],

          [Price of Pack] / [Month in Pack] AS [Accural Sum],

          Date( AddMonths([Purchase Date], iterno()-1) ) AS [Accural Date]

RESIDENT YourTable

WHILE iterno() <= [Month in Pack];

View solution in original post

5 Replies
its_anandrjs

Hi,

You have to use For Loop or Iterno() functions for this on the load script data model.

See some examples on the community on this topics.

Regards,

Anand

swuehl
MVP
MVP

Something like

LOAD [Deal ID],

          [Price of Pack] / [Month in Pack] AS [Accural Sum],

          Date( AddMonths([Purchase Date], iterno()-1) ) AS [Accural Date]

RESIDENT YourTable

WHILE iterno() <= [Month in Pack];

View solution in original post

sunny_talwar

Try this:

Table:

LOAD PricePerMonth,

  DealID,

  AddMonths(PurchaseDate, IterNo() - 1) as PurchaseDate

While IterNo() <= Month;

LOAD *,

  Price/Month as PricePerMonth

Inline [

Price, PurchaseDate, Month, DealID

6000, 18.02.2016, 6, 1

5000, 01.02.2016, 4, 2

];


Capture.PNG

its_anandrjs

Hi,

Try this ways

Temp:

LOAD PriceOfPack / MonthinPack as PriceOfPack, AddMonths( PurDate, IterNo()-1) as PurDate ,MonthinPack,DealId,IterNo() as ID

While IterNo() <= MonthinPack;

LOAD PriceOfPack,Date#(PurDate,'DD.MM.YYYY') AS PurDate,MonthinPack,DealId;

LOAD * Inline

[

PriceOfPack,PurDate,MonthinPack,DealId

6000,18.02.2016,6,1

5000,01.02.2016,4,2

];

Regards

Anand

evgeniystuchalk
Partner
Partner
Author

exactly what I need Thanks