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: 
adiarnon
Creator III
Creator III

help with scritp

hi,

i have this table

metriccomponent
1a
1b
1c
2d
2e
3f
3e
4s
4r
4g
5j

and i want to make this table-

   

metriccomponentcomponent num
1a1
1b2
1c3
2d1
2e2
3f1
3e2
4s1
4r2
4g3
5

j

1

how should i do it?

in the script

adi

4 Replies
sunny_talwar

May be this

LOAD metric,

     component,

     AutoNumber(component, metric) as [component num],

FROM ...;

Anil_Babu_Samineni

May be this?

LOAD metric, component, AutoNumber(RowNo(), metric) as [component num]

FROM [https://community.qlik.com/message/1313537]

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

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
m_woolf
Master II
Master II

load

     *,

     if(metric=peek('metric'),peek('component num')+1,1) as [component num];

from YourTable

order by metric, component;

manas_bn
Creator
Creator

This should work.

Fact:

//Create Row ID

load *,RowNo() as Row_ID;

Load * inline

[Metric,Component

1,a

1,b

1,c

2,d

2,e

3,f

3,e

4,s

4,r

4,g

5,j];

// Create Rank

left join (Fact)

load

Row_ID,if(Metric=previous(Metric),peek(Rank)+1,1) as Rank

resident Fact;

Rank.PNG