Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

if or where?

I have a simple expression where the dimension is YEAR. For the year 2010, my expression gives me the incorrect total (this is because the source data is incorrect and I cannot change it) so for 2010 I need to add an extra 4 to the count - how can I do this?

Sum({1<StatusFlagID={'*1*'}, IncidentType={'*Accident*'}, ListTitle={'*Employee*'}>}StatusFlagID)

Thanks

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: if or where?

You need to use either

rangesum(sum(....), if(YEAR=2010,4))

or

sum(....) + if(YEAR=2010,4,0)

if(YEAR=2010,4) will return NULL for all YEAR <> 2010, and adding NULL to something returns NULL (rangesum will handle this gracefully).

Hope this helps,

Stefan

View solution in original post

3 Replies
Highlighted
Partner
Partner

Re: if or where?

Hi,

If you have data inconsistency, I would very much recommend you to fix it in the script and not in the object expression. Not even in the front-end application script but on a previous transformation level of QVWs.

However, you can add it like this:

SUM(...) + IF(YEAR=2010, 4)
Highlighted
Not applicable

Re: if or where?

that doesn't seem to be working..any ideas?

Highlighted
MVP
MVP

Re: if or where?

You need to use either

rangesum(sum(....), if(YEAR=2010,4))

or

sum(....) + if(YEAR=2010,4,0)

if(YEAR=2010,4) will return NULL for all YEAR <> 2010, and adding NULL to something returns NULL (rangesum will handle this gracefully).

Hope this helps,

Stefan

View solution in original post