Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
cdss-developer
Contributor III
Contributor III

Renumber per (Duplicate)ID

Hello everyone, I need some help with this.

In this example you can see that I made a DuplicateID, where the Likelihood and the Impact are the same.

    

IDLikelihoodImpactRisk nameDuplicateFlagDuplicateID
323.005.00adf11
333.005.00jlkaljkdlkj11
342.003.00diekdie12
352.003.00ajaja12
362.004.00ldio13
373.004.00alalae0
382.005.00joj0
393.005.00dd11
402.004.00gw13
413.003.00ert0
425.002.00djkflskd14
434.004.00fd0
442.003.00we12
452.003.00as12
465.002.00af14
473.004.20gh0
482.003.00rr12
493.004.10ff0
502.004.00ff13
512.003.00gg12

Now, I want to have one extra column that shows each ID being renumbered starting from 1 on every DuplicateID.

Like this (column 'Result'):

      

IDLikelihoodImpactRisk nameDuplicateFlagDuplicateIDResult
323.005.00adf111
333.005.00jlkaljkdlkj112
342.003.00diekdie121
352.003.00ajaja122
362.004.00ldio131
373.004.00alalae0
382.005.00joj0
393.005.00dd113
402.004.00gw132
413.003.00ert0
425.002.00djkflskd141
434.004.00fd0
442.003.00we123
452.003.00as124
465.002.00af142
473.004.20gh0
482.003.00rr125
493.004.10ff0
502.004.00ff133
512.003.00gg126


My code:

Table:

Load * inline [

ID, Likelihood, Impact, Risk name,

32, 3.00, 5.00, adf

33, 3.00, 5.00, jlkaljkdlkj

34, 2.00, 3.00, diekdie

35, 2.00, 3.00, ajaja

36, 2.00, 4.00, ldio !

37, 3.00, 4.00, alalae

38, 2.00, 5.00, joj

39, 3.00, 5.00, dd

40, 2.00, 4.00, gw

41, 3.00, 3.00, ert

42, 5.00, 2.00, djkflskd

43, 4.00, 4.00, fd

44, 2.00, 3.00, we

45, 2.00, 3.00, as

46, 5.00, 2.00, af

47, 3.00, 4.20, gh

48, 2.00, 3.00, rr

49, 3.00, 4.10, ff

50, 2.00, 4.00, ff

51, 2.00, 3.00, gg

];

left join (Table)

load Impact, Likelihood, if(count(Likelihood)>1,1,0) as DuplicateFlag,

if(count(Likelihood)>1,AutoNumber(Impact)) as DuplicateID

Resident Table

group by Impact, Likelihood;

I think it should be very simple (I think). I hope you can help me with this.

Thanks!

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

Hi

Have a look at the attach example

View solution in original post

2 Replies
lironbaram
Partner - Master III
Partner - Master III

Hi

Have a look at the attach example

cdss-developer
Contributor III
Contributor III
Author

Yes that's it, thank you very much!
Greetings,

Eelco