Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
Partner
Partner

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

Tags (4)
1 Solution

Accepted Solutions
anbu1984
Honored Contributor III

Re: Max Field in script

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

7 Replies
Not applicable

Re: Max Field in script

try this

firstsortedvalue(Hnua08Cta ,-Hnua07Pre)

Partner
Partner

Re: Max Field in script

Manoj, Invalid Expression said

Not applicable

Re: Max Field in script

try this now

firstsortedvalue(Hnua07Pre,-Hnua08Cta )

Partner
Partner

Re: Max Field in script

Invalid

then i have to put some group by?

Not applicable

Re: Max Field in script

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

give me some sample records

Partner
Partner

Re: Max Field in script

Both of them are number(integer)

i attached the qvd and the qvw

thank you!

anbu1984
Honored Contributor III

Re: Max Field in script

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