Skip to main content
Announcements
New: No-code data prep in Qlik Cloud Analytics™ TAKE A TOUR
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Alternative of Above() Function in Backend Script.

Hi All

Is there any Alternative for Above() Function in backend Script.

I don't wan't to use Order By desc in Script.

because I need Previous() and Above() at the same time.

I have achieved Result with Previous but for Above() I haven't received the Result.

See this:

Sample Code.png

See the Attachment.

Regards

Eric

12 Replies
tyagishaila
Specialist
Specialist

Your desired output needs Below() not Above().

PFA

Cheers,

Chanty4u
MVP
MVP

i thnk below will work

chk this

Missing Manual - Above() and Below()

jvishnuram
Partner - Creator III
Partner - Creator III

Hi Eric,

You should use below() function to achieve your result, PFA

senpradip007
Specialist III
Specialist III

You can use Peek() apart from Above().

Digvijay_Singh

Try this script -

t1:

Load * inline [

Number, Name, Code_1

1,India,NOT SAME

2,India,SAME

3,Uk,NOT SAME

4,Uk,SAME

5,Uk,SAME

6,USA,NOT SAME

7,Russia,NOT SAME

8,France,NOT SAME ];

t2:

Load *,

  alt(Peek('Code_1',Recno(),'t1'),Code_1) as Code_2

Resident t1;

drop table t1;

sunny_talwar

Can be done without Aggr() function as well:

If(Below(TOTAL Name) = Name, 'Same', 'No Same')

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try Peek().

Regards,

Jagan.

sunny_talwar

Yet another method could be using a similar to As-of Table concept:

Table:

LOAD *,

      IF(Previous(Name)=Name,'SAME','NOT SAME') AS Code_1 INLINE [

NUMBER, Name

1, INDIA

2, INDIA

3, UK

4, UK

5, UK

6, USA

7, RUSSIA

8, FRANCE

];

Link:

LOAD NUMBER as LINK_NUM,

  NUMBER,

  'C' as Flag

Resident Table;

Concatenate (Link)

LOAD NUMBER as LINK_NUM,

  NUMBER + 1 as NUMBER,

  'L' as Flag

Resident Table;

Data Model:

Capture.PNG

Straight table

Dimension: LINK_NUM

Expression:

1) =Only({<Flag = {'C'}>} Name)

2) =If(Only({<Flag = {'C'}>} Name) = Only({<Flag = {'L'}>} Name), 'SAME', 'NOT SAME')

Capture.PNG

Not applicable
Author

Hi All

I appreciate each and everyone's effort but  i want the logic in Back end at Script level not at front end chart level.

Also, I need the Code_1 and Code_2 in one Load. I don't have to use concatenate.