Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
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

3 Replies
diegofcaivano
Contributor

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)
Not applicable

Re: if or where?

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

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

Community Browser