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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
slribeiro
Partner - Creator
Partner - Creator

script problem with cycles

Greetings.

I'm having a problem with fill values in a cycle.

Imagine the following table...

DatesCycle numberValue
18/09/20162-
19/09/20163-
20/09/20161-
21/09/20162-
22/09/20163-
23/09/20161100
24/09/20162200
25/09/20163300

The ideia is to repeat all the values in the previous lines by cycle number, knowing that this cycle number can be 3 sometimes or 10 other times. The number of the cycle is not importante.

The important is to reply all values for the equal cycle number.

In this case should be something like in 22/09/2016 and 19/09/2016 the value is 300 and so on...

If you could help me I will really appreciate.

Thank in advance

Simão Ribeiro

1 Solution

Accepted Solutions
sunny_talwar

How about this?

Table:

LOAD Dates,

    [Cycle number],

    Value

FROM

[https://community.qlik.com/thread/234365]

(html, codepage is 1252, embedded labels, table is @1);

Left Join(Table)

LOAD [Cycle number],

  Max(Value) as Value1

Resident Table

Group By [Cycle number];

DROP Field Value;

RENAME Field Value1 to Value;

View solution in original post

4 Replies
sunny_talwar

May be using this:

Table:

LOAD Dates,

    [Cycle number],

    Value

FROM

[https://community.qlik.com/thread/234365]

(html, codepage is 1252, embedded labels, table is @1);

FinalTable:

NoConcatenate

LOAD Dates,

  [Cycle number],

  If([Cycle number] = Previous([Cycle number]), Alt(Peek('Value'), Value), Value) as Value

Resident Table

Order By [Cycle number], Value;

DROP Table Table;


Capture.PNG

slribeiro
Partner - Creator
Partner - Creator
Author

This doesn't work because I can't change the order of the data set.

It has to be like this... That's why the mess

sunny_talwar

How about this?

Table:

LOAD Dates,

    [Cycle number],

    Value

FROM

[https://community.qlik.com/thread/234365]

(html, codepage is 1252, embedded labels, table is @1);

Left Join(Table)

LOAD [Cycle number],

  Max(Value) as Value1

Resident Table

Group By [Cycle number];

DROP Field Value;

RENAME Field Value1 to Value;

miguelbraga
Partner - Specialist III
Partner - Specialist III

How about this solution?

Table:

LOAD Dates,

     [Cycle number],

     Value

FROM

[https://community.qlik.com/thread/234365]

(html, codepage is 1252, embedded labels, table is @1);

T:

LOAD *,

     if(isnull(Value) or Value = '-', 0, Value) as Value1

Resident Table;

Drop Table Table;

T1:

Mapping LOAD [Cycle number],

     Max(Value1) as Value2

Resident T

Group By [Cycle number];

FinalTable:

LOAD *,

     ApplyMap('T1', [Cycle number]) as Value3

Resident T;

Drop Table T;

Drop Fields Value1, Value From FinalTable;

Rename Field Value3 To Value;

Best regards,

D.A. MB