Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
sandeepbijoor
New Contributor

Invalid expression

if(match(Timesheet_Weekno,Max(Timesheet_Weekno)),[Project Manager Name]) as MaxWeekProjectManagerName

Why this expression is giving error ? Please help me

1 Solution

Accepted Solutions

Re: Invalid expression

You can left join the MaxTimesheet_Weekno field while getting Max Timesheet_Weekno and then use this field  for calcualtion.

Left Join(Source)

Load

Max(Timesheet_Weekno) a MaxTimesheet_Weekno

Resident  Source;


Load *,

if(match(Timesheet_Weekno,MaxTimesheet_Weekno),[Project Manager Name]) as MaxWeekProjectManagerName

From Source;


Drop Table Source;

7 Replies

Re: Invalid expression

Are you doing this in Expression or Script?

Life is so rich, and we need to respect to the life !!!
MVP
MVP

Re: Invalid expression

You are using aggregation function max(), that would require group by clause in the script when used with more fields in the load. Try like:

Load

          Field1,

          Field2

          <your statement>

From <> group by Field1, Field2...;

Re: Invalid expression

In your expression you are using Max() which is require Group By statements and grouping on the dimension, so you can't use with out using Group By clause in your statement.

Try

Load

Fields1,

Fields2,

if(match(Timesheet_Weekno,Max(Timesheet_Weekno)),[Project Manager Name]) as MaxWeekProjectManagerName

From Source

Group By

Timesheet_Weekno,

[Project Manager Name],

Fields,,,,,;


Please read about the Aggr or Group By.


sushil353
Honored Contributor II

Re: Invalid expression

Hi,

Create your max function is some variable

LET vMaxMonth = Max(Timesheet_Weekno);

if(match(Timesheet_Weekno,'$(vMaxMonth )'),[Project Manager Name]) as MaxWeekProjectManagerName


HTH

Sushil

Re: Invalid expression

You can left join the MaxTimesheet_Weekno field while getting Max Timesheet_Weekno and then use this field  for calcualtion.

Left Join(Source)

Load

Max(Timesheet_Weekno) a MaxTimesheet_Weekno

Resident  Source;


Load *,

if(match(Timesheet_Weekno,MaxTimesheet_Weekno),[Project Manager Name]) as MaxWeekProjectManagerName

From Source;


Drop Table Source;

sandeepbijoor
New Contributor

Re: Invalid expression

Thank you everyone for help. Problem got solved by group by

oknotsen
Honored Contributor III

Re: Invalid expression

If your question is now answered, please flag the Correct Answer (via the big "Correct Answer" button near every post; not visible in preview) and Helpful Answers (found under the Actions menu under every post).

If not, please make clear what part of this topic you still need help with .

May you live in interesting times!
Community Browser