Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
stabben23
Honored Contributor

Previous first row

Hi,

I have a problem building a flag in script. I have use previous and get a correct output, expect first row.

Here is my table.and this is for changeflag if(previous(dimension)=dimension  ,0,1)

What I want is to get a 1 on the first row With a New Dimension. I think that the first 1 will be there because previous find null and compare it With the first row.

Any trix to avoid this scenario?

Tags (1)
1 Solution

Accepted Solutions
kenphamvn
Contributor III

Re: Previous first row

Hi

using RowNo() like a trick

if(previous(dimension)=dimension or rowno() =1  ,0,1)

8 Replies
ksomosera10
Contributor

Re: Previous first row

Hi,

I think you'll have to use a calculated dimension

for example is like this.


=if(field2='field2value',field1)


Is that good or not?

stabben23
Honored Contributor

Re: Previous first row

Hi Kevin,

this is in script not in a pivot.

ksomosera10
Contributor

Re: Previous first row

So you're sayin' this is on the load script?

kenphamvn
Contributor III

Re: Previous first row

Hi

using RowNo() like a trick

if(previous(dimension)=dimension or rowno() =1  ,0,1)

antoniotiman
Honored Contributor III

Re: Previous first row

Hi Staffan,

maybe this

if(previous(dimension)=dimension  or RowNo()=1 ,0,1)

Regards,

Antonio

MVP
MVP

Re: Previous first row

You can perhaps just try putting rowno()=1 check like:

if(if rowno()=1 or previous(dimension) <> dimension  ,1 , 0)

stabben23
Honored Contributor

Re: Previous first row

Three similar answer, let give it a try.

stabben23
Honored Contributor

Re: Previous first row

The rowno() check will help me, thanks guys.

Community Browser