Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. 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?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
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!