Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
samuel_brierley
Creator
Creator

only load certain rows

Hi all,

dead quick one...

is there a way to only load in certain value i.e with the if statement if the conditions aren't met a null is created but I just don't want to load it in at all.

Load
[Vehicle type],
[Euro standard],
[Average Speed (km/h)] as [Speed(Lane 1)],
if([Vehicle type] = 'Artic' and [Euro standard] = 'Euro VI',avg([NOx EF (g/km)])) as [Artic 6 Emissions]

FROM

(
ooxml, embedded labels, table is HGV) group by [Vehicle type], [Euro standard], [Average Speed (km/h)];

thanks all

3 Replies
Michael_Tarallo
Employee
Employee

Hello Samuel

Check this out and let us know how you do and if you need more assistance:

http://help.qlik.com/sense/2.0/en-US/online/#../Subsystems/Hub/Content/Scripting/ScriptRegularStatem...

"where is a clause used for stating whether a record should be included in the selection or not. The selection is included if criterion is True.

criterion is a logical expression."

Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik
sunny_talwar

Try this:

Load [Vehicle type],
         [Euro standard],
         [Average Speed (km/h)] as [Speed(Lane 1)],
        Avg([NOx EF (g/km)]) as [Artic 6 Emissions]
FROM

(ooxml, embedded labels, table is HGV)

Where Match([Vehicle type], 'Artic', 'Euro VI')

Group By [Vehicle type], [Euro standard], [Average Speed (km/h)];

maxgro
MVP
MVP

I think just a little change, move the if in the where part

Load

[Vehicle type],

[Euro standard],

[Average Speed (km/h)] as [Speed(Lane 1)],

// replace this

// if([Vehicle type] = 'Artic' and [Euro standard] = 'Euro VI',avg([NOx EF (g/km)])) as [Artic 6 Emissions]

// with

avg([NOx EF (g/km)]) as [Artic 6 Emissions]

FROM

(ooxml, embedded labels, table is HGV)

// and add the filter in where

where [Vehicle type] = 'Artic' and [Euro standard] = 'Euro VI'

group by [Vehicle type], [Euro standard], [Average Speed (km/h)];