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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
saumyashah90
Specialist
Specialist

Peek field for some values having null and not null

Hi

I have Data as shown below

Header 1Header 2Header 3
a1HI
a1
a2
a2
a3HELLO
b3
b3

else

PFA 1.JPG

I want to repeat Header3 value i.e" HI " for value of Header2 "1" ,and not for "2",same for HELLO for Header2 value "3"

I used Peek

Command  :    If(IsNull(Header3),Peek(Header3),Header3)

but it shows HI value for Header2 value "1" and "2" both

as Shown

Header 1Header 2Header 3
a1HI
a1

HI

a2HI
a2HI
a3HELLO
b3HELLO
b3HELLO
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

LOAD

            [Header 1]

          , [Header 2]

          , if(len(trim([Header 3]))=0 and Previous([Header 2])=[Header 2], peek([Header 3]),[Header 3]) as [Header 3]

//      , RowNo() as rowid

INLINE [

    Header 1, Header 2, Header 3

    a, 1, HI

    a, 1,

    a, 2,

    a, 2,

    a, 3, HELLO

    b, 3,

    b, 3

];

See attached example


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
swuehl
MVP
MVP

Try

If(IsNull(Header3) and Header2 = peek(Header2),Peek(Header3),Header3)

saumyashah90
Specialist
Specialist
Author

Nope, not getting

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

LOAD

            [Header 1]

          , [Header 2]

          , if(len(trim([Header 3]))=0 and Previous([Header 2])=[Header 2], peek([Header 3]),[Header 3]) as [Header 3]

//      , RowNo() as rowid

INLINE [

    Header 1, Header 2, Header 3

    a, 1, HI

    a, 1,

    a, 2,

    a, 2,

    a, 3, HELLO

    b, 3,

    b, 3

];

See attached example


talk is cheap, supply exceeds demand
saumyashah90
Specialist
Specialist
Author

Hi Gysbert

I got proper output using RowNo() as RowId.

Can you tell me reason for existence of RowNo() as RowId?

Because when i reload it withour using RowNo i dont get proper required output.

er_mohit
Master II
Master II

See the attached file excel and qlikview

hope it helps you

saumyashah90
Specialist
Specialist
Author

Hey i am sorry if i am was not specific.

I meant to say for that particular solution(which gysbert gave) i need to know it

According to me without Rowno() also we should get proper ouput but its not

saumyashah90
Specialist
Specialist
Author

Hey mohit,

I understood

Thanks