Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sandeepbijoor
Contributor II
Contributor II

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
its_anandrjs

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;

View solution in original post

7 Replies
Anil_Babu_Samineni

Are you doing this in Expression or Script?

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
tresesco
MVP
MVP

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...;

its_anandrjs

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
Master II
Master II

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

its_anandrjs

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
Contributor II
Contributor II
Author

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

oknotsen
Master III
Master III

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!