Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Max functin not working with applymap

HI All,

I have below sample code .But the max is not working with the applymap.Getting an error in script execution.

Regiongrouping:

mapping load

  Region,

     (max(orderdate))

FROM

(biff, embedded labels)

group by Region;

OderData:

LOAD Region,

     orderdate,

     applyMap ('Regiongrouping', Region) as [Max oderdate],

     value,

     comment

FROM

(biff, embedded labels);

Why is this so?

6 Replies
sunny_talwar

Can you attach your Test.xls file for testing out your code?

Best,

Sunny

anbu1984
Master III
Master III

What is the error message?

anbu1984
Master III
Master III

Instead of mapping load, you can use Left join like below

OderData:

LOAD Region,

    orderdate,

    value,

    comment

FROM

(biff, embedded labels);


Left Join(OderData)

Load Region,max(orderdate) As [Max oderdate] Resident OderData Group by Region;

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Why don't you remove the bracket from behind Max, See below

Regiongrouping:

mapping load

  Region,

     max(orderdate)

FROM

(biff, embedded labels)

group by Region;

OderData:

LOAD Region,

     orderdate,

     applyMap ('Regiongrouping', Region) as [Max oderdate],

     value,

     comment

FROM

(biff, embedded labels);

maxgro
MVP
MVP

your code works on my QlikView and with some test data (test.xls)

could you post your excel and the error?

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

I would ensure you have a field name on the Max in the ApplyMap.  It's strange that it's inconsistent if this falls over or not, but I would certainly add it for completeness:

(max(orderdate)) as OD,

As  Gabsus04 states the brackets are superflous, but will not cause an issue.

The name of the field in the ApplyMap is not used anywhere - but it is probably better to have it.

Steve