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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
micheledenardi
Specialist II
Specialist II

Find max Value

hi experts,

i have a table structured as below and i want to find the greatest version for each program, so for program 1 the greatest(leatest) version is 3.2.9 and for program 2 is 3.1.0.

How can i achieve this result ?


Program

Version
11.0.1
13.2.9
12.13.4
11.9.6
13.2.18
23.0.12
22.0.2
23.1.0
22.13.13
Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Labels (1)
14 Replies
antoniotiman
Master III
Master III

Why not ?

See Attachment.

micheledenardi
Specialist II
Specialist II
Author

Yes, 3.2.18 is the greatest version for program 1 but the greatest version for program 2 is 3.1.0 and not 21313 (2.13.13)

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Try this:

LOAD Program,

Dual(Version, subfield(Version, '.', 1) & num(subfield(Version, '.', 2), '00') & num(subfield(Version, '.', 3), '00')) as Version

;

LOAD * Inline

[

Program,Version

1,   1.0.1

1,   3.2.9

1,   2.13.4

1,   1.9.6

1,   3.2.18

2,   3.0.12

2,   2.0.2

2,   3.1.0

2,   2.13.13

];

Kushal_Chawda
MVP
MVP

or simply

Data:

LOAD *,

num(SubField(Version,'.',1),'00') & num(SubField(Version,'.',2),'00') & num(SubField(Version,'.',3),'00') as Number

Inline [

Program, Version

1, 1.0.1

1, 3.2.9

1, 2.13.4

1, 1.9.6

1, 3.2.18

2, 3.0.12

2, 2.0.2

2, 3.1.0

2, 2.13.13

3,  2.7.1

3,  2.13.3];

Create straight table

Dimension:

Program

Expression:

=FirstSortedValue(Version,-Number)

its_anandrjs
Champion III
Champion III

Ok then one solution is this also for you kindly check once

MainTab:
LOAD *,PurgeChar(Version,'.') as ModiVersion;
LOAD * Inline
[
Program,Version
1,  1.0.1
1,  3.2.9
1,  2.13.4
1,  1.9.6
1,  3.2.18
2,  3.0.12
2,  2.0.2
2,  3.1.0
2,  2.13.13
]
;

MaxVersion:
LOAD
Program,
Max(ModiVersion) as MaxVer
Resident MainTab Group By Program;

MaxVerFinal:
Mapping LOAD
MaxVer,'Max Ver' as MaxFlag
Resident MaxVersion;
DROP Table MaxVersion;

NoConcatenate
Final:
LOAD
*,
ApplyMap('MaxVerFinal',ModiVersion,'None') as MaxVerField
Resident MainTab;

DROP Field ModiVersion;
DROP Table MainTab;
EXIT Script;


OutPut:-

op.PNG

See attached also