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

Removing values in an expression

I would like to remove (or display a null - blank) in place of any percentages 0 or less.  I would like to do this in the expression and not the load script, if possible.  I tried the code below but it didn't work.  The data comes from the table already caculated as a percent.  So, in the image below I just want a blank cell for -87%, -11% etc.  It seems like this would be very simple, but can't get it to work.  Thanks,

 

if(ContributionMarginPCT <= 0.00,null(),ContributionMarginPCT)

Screenshot-removing values.JPG


4 Replies
MK_QSL
MVP
MVP

IF(SUM(Sales)<=0,0,SUM(Sales))

so here

IF(YOUREXPRESSION <=0, 0, YOUREXPRESSION)

JonnyPoole
Former Employee
Former Employee

I think you need an aggregation function for the expression to evaluate properly. Try this: 

if(  sum(ContributionMarginPCT) <= 0.00,null(), sum(ContributionMarginPCT))

Not applicable
Author

Thank you Manish - but now my code is working.  Weird

Not applicable
Author

Thanks Jonathan.  I tried the code above and the percentages got all messed up, so I just tried my code again and it worked.  Thanks for responding.