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: 
manoranjan_d
Specialist
Specialist

expression for percentage

=num(sum(AMT)/Sum(totalAMT),'##0%')

in this scenraio i want to avoid the null value in the denominator for the expression , since dept field have some null value. how to avoid the null in expression

18 Replies
tresesco
MVP
MVP

What is your expected output?

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Find the Attachment.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Anonymous
Not applicable

Two options:

1) Restrict AMT null values at ETL/Script level

like

Load

*,

AMT

From Table where AMT<>Null or len(AMT)>0;

2)

Did you try like this?

=num(sum(if(len(AMT)>0,AMT))

/

sum( Total if(len(AMT)>0,AMT))

,'##0%')

Chanty4u
MVP
MVP

try

=num(sum(AMT)/Sum(total  IsNull(AMT)),'##0%')

tamilarasu
Champion
Champion

Hi Manoranjan,

You can try,

=Num(Sum(amount)/Sum(TOTAL If(Len(Trim(dept))>0, amount)),'##0%')

Anonymous
Not applicable

Suresh/Chanty,

Does ISnull() work like u mentioned?

I think, it should come with IF(), is it not?

Chanty4u
MVP
MVP

yes Raj.

If(

IsNull(Expr1) = 0 AND IsNull(Expr2) = 0 AND IsNull(Expr3) = 0 ...etc.,

True(),

Null()

)

Chanty4u
MVP
MVP

if not  try

=num(sum(AMT)/Sum(total if(IsNull(dept), AMT) )AMT),'##0%')

Anil_Babu_Samineni

=num(sum(AMT)/Sum(total AMT),'##0%')

Is AMT Field is There?

=num(sum({<dept = {'*'} - {'NA'} >} AMT)/Sum(total {<dept = {'*'} - {'NA'} >} AMT),'##0%')

OR Else, Can you let me know what you want to Achieve?

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