Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
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

Labels (1)
18 Replies
manoranjan_d
Specialist
Specialist
Author

I want to avoid the Null as well as the NA in the demonitor , since dept have null as well as the Na value?

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Have a look at the application attached in my earlier post.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
manoranjan_d
Specialist
Specialist
Author

amountdeptpresentabsentSECTIONstudent
100cseabsentSEC91
100cseabsentSEC101
100csePresentSEC21
100eceabsentSEC351
100eceabsentSEC401
100ecePresentSEC31
100ecePresentSEC341
100ITabsentSEC41
100ITabsentSEC51
100ITPresentSEC11
100NAabsentSEC351
100NAabsentSEC401
100NAPresentSEC31
100NAPresentSEC341
100 absentSEC351
100 absentSEC401
100 PresentSEC31
100 PresentSEC341

now i want to calculate the amount percentage as per the dept wise, so i n the dept we have null and NA values

so while making calculation how to avoid the dept of null and NA?

i m normally using =num(sum(AMT)/Sum(totalAMT),'##0%') so this will take the Null as as well as the NA value, so i want to avoid the NUll and NA in the calculation part

how to do this

manoranjan_d
Specialist
Specialist
Author

as per the demanitor part Sum(totalAMT),'##0%')  this will take over all right, so i wan to avoid the Null and NA in this demanitor ?

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Posting code here, in case you are unable to open the application.

Add below 2 lines in script.

NullAsValue *;

Set NullValue = 'NA';

Then update your chart expression as.

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

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
manoranjan_d
Specialist
Specialist
Author

no as per the requirement i cant do that,  pls ust give me idea in the calculation part

tamilarasu
Champion
Champion

Hi,

Try this,

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

Anil_Babu_Samineni
MVP
MVP

Try This

=Num(Sum(amount)/Sum(TOTAL If(Len(Trim(dept),'',dept)>0 and dept -= {'NA'},amount)),'##0%')


=if(your expression=0,'',your expression)

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
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

I can see the duplicate data.

Can you tell us what output you are expecting?

If it is as below.

Capture.PNG

Then use below expression.

Sum(Aggr(sum(Distinct amount),SECTION)) / Sum(Total Aggr(sum(Distinct amount),SECTION))

Regards,

Kaushik Solanki

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