Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to remove negative and null values from expression

Dear Tamil,

Here is the sample file,

Dear Experts,

COLL_CODELOAN_NONAMEAREASLOANNO_OF_INS
CHEQUERL0068A.M.C.L.ATTANAYAKE03000000
CL001RL0013D.A.DAGLAS2250010000018
RL0035K.LIYANARACHCHI100002000040
RL0044P.D.GAMAGE224002000009
RL0050M.A.K.I.FERNANDO2975015000015
RL0051D.M.R.S.THENNAKOON135002000005
RL0054R.G.PREMACHANDRA25002000001
RL0067A.M.R.BANDARA325250001
RL0069K.P.ARIYASENA0500000
RL0071S.A.U.PALITHA20300000
RL0073J.M.DUSHANTHA0500000
RL0074E.G.D.M.K.PRADEEP-47525000-1
RL0075T.G.A.LASANTHIKA01000000
RL0076K.U.SARANAPALA25002000001
RL0077G.V.C.JAYATHILAKA-35050000-1
RL0078N.M.P.NAWARATHNE-35050000-1
RL0082D.M.R.S.THENNAKOON3900700004
RL0089L.S.GAJANAYAKA-675150000-0
RL0092J.C.KUMARI01000000
RL0093K.R.SILVA-250150000-0
RL0100V.SHIVAKUMAR0250000
Total105295
CL002RL0081A.R.THILAKARATHNE01000000
RL0085N.SIVARAJAH575500001
RL0086M.KALEIRAJAH390300001
RL0090D.R.T.SABRIN-150060000-2
RL0095S.H.M.SHAKEER-7525000-0
RL0099J.M.C.P.K.JAYATHILAKA01000000
RL0101R.M.SARATH190150001
Total-420


My pivot table shown above.

AREA = SUM(IF(STATUS='ACTIVE', IF(FLAG='A'OR FLAG='R',(RECIEVABLE-RECEIPT_AMT))))

LOAN = IF(STATUS='ACTIVE', LOAN_AMOUNT)

NO_OF_INS = RANGESUM(AREAS)/INS_AMT

I want to remove the negative and null values from the resulted table. so How can I modify my expressions to do the same?

Thanks in Advance.

Priyantha.

28 Replies
ajsjoshua
Specialist
Specialist

hi,

IF u want to get the subtotal correct use >o for only in Area

lik this

AREA =if( SUM(IF(STATUS='ACTIVE', IF(FLAG='A'OR FLAG='R',(RECIEVABLE-RECEIPT_AMT))))>0,SUM(IF(STATUS='ACTIVE', IF(FLAG='A'OR FLAG='R',(RECIEVABLE-RECEIPT_AMT)))))

LOAN = IF(STATUS='ACTIVE', LOAN_AMOUNT)

NO_OF_INS = RANGESUM(AREAS)/INS_AMT

Anil_Babu_Samineni

Priyantha, Follow this Null Values --> https://community.qlik.com/thread/85918 Negative Values --> https://community.qlikview.com/thread/115551

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tamilarasu
Champion
Champion

Fine.

AREAS: If(SUM(IF(STATUS='ACTIVE', IF(FLAG='A'OR FLAG='R',(RECIEVABLE-RECEIPT_AMT))))>0, SUM(IF(STATUS='ACTIVE', IF(FLAG='A'OR FLAG='R',(RECIEVABLE-RECEIPT_AMT)))))

LOAN:  If(Not Isnull(AREAS), IF(STATUS='ACTIVE', LOAN_AMOUNT))

NO_OF_INS: RANGESUM(AREAS)/INS_AMT

stephenedberkg
Creator II
Creator II

hi

You can write script itself that is the easiest way for your requirement

script add this

if( AREAS >0, 1, 0) as Flags,

in expression

=sum({<  Flags = {'1'}  >}AREAS)

sunny_talwar

Is the issue resolved yet? If it is, please close this thread, if it isn't please let us know what isn't working.

Qlik Community Tip: Marking Replies as Correct or Helpful

Not applicable
Author

Dear Sunny,

Expected output is achieved from the expressions introduced above, But as i think there should be one more modification to this. Still i'm trying to find the way.

Thanks.

Priyantha.

sunny_talwar

Would you be able to point out what is still missing? I might have missed it in the conversation above

Not applicable
Author

Even though your expression removes the negative and null values the impact negative values are available in the grand total.

As i think 'sum' function to be take to the front of the expression instead of 'if'. But i couldn't do the thing successfully.

sunny_talwar

I guess try using Sum(Aggr(, dimensions)) to get the grand total here

sunny_talwar

Not sure which expression actually worked, but try adding this to the expression which worked:

Sum(Aggr(Expression, COLL_CODE, LOAN_NO, NAME))