Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
fkeuroglian
Partner - Master
Partner - Master

Max Field in script

Hi expert,

i have  2 fields, Hnua08Cta and Hnua07Pre, for each Hnua08Cta could be more than 1 values, i want to only bring the max Hnua07Pre value

is this posible to do this in the script?

using firstsortvalue() or max function?

i attached a qvw and a qvd to see this example

thank you a lot

Fernando

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

LOAD HnuA07Cta,

     Max(HnuA07PRe),

     FirstSortedValue(HnuA07PRe,-HnuA07PRe )

FROM

[HNUA07.qvd]

(qvd) Group by HnuA07Cta;

FirstSortedValue may not work for few rows since you have duplicates in Hnua07Pre

View solution in original post

7 Replies
Not applicable

try this

firstsortedvalue(Hnua08Cta ,-Hnua07Pre)

fkeuroglian
Partner - Master
Partner - Master
Author

Manoj, Invalid Expression said

Not applicable

try this now

firstsortedvalue(Hnua07Pre,-Hnua08Cta )

fkeuroglian
Partner - Master
Partner - Master
Author

Invalid

then i have to put some group by?

Not applicable

may i know what kind of data u have in the fields

give me some sample records

fkeuroglian
Partner - Master
Partner - Master
Author

Both of them are number(integer)

i attached the qvd and the qvw

thank you!

anbu1984
Master III
Master III

LOAD HnuA07Cta,

     Max(HnuA07PRe),

     FirstSortedValue(HnuA07PRe,-HnuA07PRe )

FROM

[HNUA07.qvd]

(qvd) Group by HnuA07Cta;

FirstSortedValue may not work for few rows since you have duplicates in Hnua07Pre