Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

invalid expression; what is wrong?

I have a question. I have make a expression, when I click on reload then I get the error: invalid expression.

What is wrong with the expression? Can someone help me with the error?

thanks in advance.

My expression is:

LOAD [%Airline ID],

     [%Carrier Group ID],

     [%Unique Carrier Code],

     [%Unique Carrier Entity Code],

     [%Region Code], 

     //[%Destination Airport Sequence ID],

    // [%Destination Airport Market ID],

    // [%Destination World Area Code],

     [%Aircraft Group ID],

     [%Aircraft Type ID],

     [%Aircraft Configuration ID],

     [%Distance Group ID],

     [%Service Class ID],

     [%Datasource ID],

     Sum ( [# Departures Scheduled] ) as [# Departures Scheduled] ,

     Sum ( [# Departures Performed]) as [# Departures Performed],

     Sum ([# Payload] ) as [# Payload],

     Distance,

     sum ( [# Available Seats] ) as [# Available Seats],

     sum ( [# Transported Passengers] ) as [# Transported Passengers],

     sum ( [# Transported Freight] ) as [# Transported Freight],

     sum ( [# Transported Mail] ) as [# Transported Mail],

     sum ( [# Ramp-To-Ramp Time] ) as [# Ramp-To-Ramp Time],

     sum ( [# Air Time] ) as [# Air Time],

     [Unique Carrier],

     [Carrier Code],

     [Carrier Name],

     [Origin State Code],

     Year,

     Period,

     Quarter,

     [Month (#)],

     Month

    

FROM

(qvd)

Group By [%Airline ID], [%Carrier Group ID], [%Unique Carrier Code],

[%Unique Carrier Entity Code], [%Region Code], [%Aircraft Group ID],

[%Aircraft Type ID], [%Aircraft Configuration ID], [%Distance Group ID],[%Service Class ID], [%Datasource ID], [Unique Carrier], [Carrier Code],

[Carrier Name], Year, Period, Quarter, [Month (#)], Month;

4 Replies
Anonymous
Not applicable
Author

In the "group by", you missed fields Distance and [Origin State Code]

maxgro
MVP
MVP

with a group by

all non aggregated fields (in your example the fields without sum) must be in the group by section

so add [Origin State Code] and Distance to the group by (well, check also the other fields)

Anonymous
Not applicable
Author

you can't write sum() in script like this without taking all the fields in account in group by statement. could you explain what you want to do or attach your app.

sunny_talwar

You also need to make sure that if your table name has spaces in it, it is between the square brackets ([My expression is])

Once you fix that there might be other things that might be needing a fix, but make that fix and let us know if it works or not.

Best,

S