Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

souadouert
Contributor III

Invalid expression

Invalid expression  *, when i put al column in group by , works but dont need put all column  , i have to calculated mesures by client ID

CLIENT:

LOAD ID as CLIENT_ID ,

     MMM,

     SMV,

     NBR

FROM

(qvd);


Score:

load 

CLIENT_ID,



MMM/(MAX (MMM))*100 as MMM1,

SMV/(MAX (SMV))*100 AS VRD1,

NBR/(MAX (NBR))*100 AS RELATION1

resident CLIENT

Group BY CLIENT_ID;

4 Replies
stabben23
Honored Contributor

Re: Invalid expression

Well, thats the only whay here, use all Field in Group by.

But that will gives you one measure per CLIENT_ID,or?

Score:

load 

CLIENT_ID,

MMM/(MAX (MMM))*100 as MMM1,

SMV/(MAX (SMV))*100 AS VRD1,

NBR/(MAX (NBR))*100 AS RELATION1

resident CLIENT

Group BY CLIENT_ID,MMM,SMV,NBR;

MVP
MVP

Re: Invalid expression

You can't reference max(MMM) and MMM in the same load statement. This will need 3 steps:

CLIENT:

LOAD ID as CLIENT_ID ,

     MMM,

     SMV,

     NBR

FROM

(qvd);

Join(CLIENT)

LOAD

  CLIENT_ID,

  MAX (MMM) as MMM1,

  MAX (SMV) AS SMV1,

  MAX (NBR) AS NBR1

Resident CLIENT

Group BY CLIENT_ID;

Score:

LOAD CLIENT_ID,

     MMM,

     SMV,

     NBR,

     MMM / MMM1 * 100 as MMM1,

     SMV / SMV1 * 100 as VRD,

     NBR / NBR1 * 100 as RELATION

Resident CLIENT;

DROP Table CLIENT;

souadouert
Contributor III

Re: Invalid expression

thank you  Jonath but with this script i have the same result for all MMM SMV NBR

MVP
MVP

Re: Invalid expression

I suggest you post a small sample qvw and data file and clearly indicate the output you require.

Community Browser