Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with If statement

Hi guys! I'm a new QlikView user and I need to make that shows sales which were made during 2012 year. I want to make an if expression which have to be something like that: if (year=2012), then Sales else Null end. I tried this one if (year=2012, Sales, Null), but it says that Null is a bad field. Thank you in advance!

1 Solution

Accepted Solutions
its_anandrjs

Write like expression like

if(Year = 2012 , Sum(Sales),Null( ))

View solution in original post

7 Replies
sudeepkm
Specialist III
Specialist III

you may use set analysis

sum({<Year = {2012}>} Sales)

or you can make it dynamic:

sum({<Year = {"$(=max(Year))"} >}Sales)

bbi_mba_76
Partner - Specialist
Partner - Specialist

Hi,

it is possible to write

if (year=2012, Sales)

if (year=2012, Sales, Null() )

but I don't see any aggregation.. sum( if (year=2012, Sales ))

or using set analysis sum({<year={2012}>} Sales)

its_anandrjs

Write like expression like

if(Year = 2012 , Sum(Sales),Null( ))

SunilChauhan
Champion II
Champion II


sum(if(Year=2012,Sales)

and Year in dimension

it will automake - for year other than 2012

go to presentation-> missing symbol type null there

and null symbol_. type null there

Sunil Chauhan
Not applicable
Author

Try this

=if (year='2012', sum(Sales), 'Null')

hope it will help........

Not applicable
Author

Guys, you're awesome! Thank you for the quick answers!

its_anandrjs

I am Glad thanks

Thanks & Regards