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: 
Not applicable

[ASK] why i cant include max function in edit script?

hello..

i'm kinda new in qlikview

so i have a table in qvd, just say its name is TRY

it have 3 columns :

1. date_col

2. value_col

3. code_col

so in 1 day we can have many value_col

but i need only to load max value of it into qvw

i've tried :

LOAD

date_col, max(value_col), code_col

FROM

(qvd);

but it's not working

so, how to do that?

can qlikview do that?

thx..

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Aggregation functions like Max normally need to have some grouping applied if you have other non-aggregated fields in your load sattement.

So this


LOAD max(value_col)
FROM (qvd);


is a valid statement and would find the overall max of that field. In your case, you have two non-aggregated fields, so you may need something like:


LOAD date_col, max(value_col), code_col
FROM (qvd)
GROUP BY date_col, code_col;


Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Aggregation functions like Max normally need to have some grouping applied if you have other non-aggregated fields in your load sattement.

So this


LOAD max(value_col)
FROM (qvd);


is a valid statement and would find the overall max of that field. In your case, you have two non-aggregated fields, so you may need something like:


LOAD date_col, max(value_col), code_col
FROM (qvd)
GROUP BY date_col, code_col;


Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

hello Jon..

i've tried ur solution

but the data keeps show detail data, not the maximum value data

jonathandienst
Partner - Champion III
Partner - Champion III

RandyDeP

It will show the maximum value of value_col for each combination of date_col and code_col.

If there is only one value of value_col for each combination in your source data, then the max function has nothing to aggregate, so it will return every record.

Perhaps you could post a sample of your data for further investigation?

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein