Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Chanty4u
Esteemed Contributor III

RE:Negative values ?

Hi all,

Sunny T,Kush141087,Avinash R,,jagan mohan rao appala,

below expression givng me negative values on my bar chart

Formuale:(No of Defects Fixed within 3 days from the date of defect opened / Total number of defects)*100

I want to caluclate % for <=1day

<=2Days

<=3Days

>3days

=Count({<Defect_Aging_Days='<=1'>}Def_ID)/num(count(Def_ID))*100

what wrng in my Exp?

Thanks in advance.

1 Solution

Accepted Solutions
sasikanth
Valued Contributor III

Re: RE:Negative values ?

hi,

PFA Application

12 Replies
MVP
MVP

Re: RE:Negative values ?

Missing curly brackets.

=Count({<Defect_Aging_Days={'<=1'}>}Def_ID)/num(count(Def_ID))*100

MVP & Luminary
MVP & Luminary

Re: RE:Negative values ?

Hi,

Generally count won't give negative values, it always returns a positive value, try below expression

=(Count({<Defect_Aging_Days={'<=1'}>}Def_ID)/count(Def_ID))*100


Hope this helps you.


REgards,

Jagan.

MVP & Luminary
MVP & Luminary

Re: RE:Negative values ?

I don't see how you can get negative numbers using counts. But your expression is not correct. Try this instead: Num(Count({<Defect_Aging_Days={'<=1'}>}Def_ID)/(count(Def_ID)*100,'0.0%')


talk is cheap, supply exceeds demand
Chanty4u
Esteemed Contributor III

Re: RE:Negative values ?

thanx all...but if i use if statmnt i can i  implements with in dat

because i want to display in barchart

<=1day

<=2Day

<=3Days

>3Days

How can i ?

MVP & Luminary
MVP & Luminary

Re: RE:Negative values ?

Hi,

Create a bucket in script like below

LOAD

*,

If(Defect_Aging_Days > 3, '>3 Days',

If(Defect_Aging_Days = 3, '3 Days',

If(Defect_Aging_Days = 2, '2 Days',

If(Defect_Aging_Days <= 1, '<= 1 Day')))) AS Age_Bucket

FROM DataSource;


Now use Age_Bucket as dimension and use below expresions

=Num(Count(Def_ID)/(count(TOTAL Def_ID)*100,'0.0%')


Hope this helps you.

Regards,

jagan.

Chanty4u
Esteemed Contributor III

Re: RE:Negative values ?

the exp shwng error

Chanty4u
Esteemed Contributor III

Re: RE:Negative values ?

for ur  exprsn givng 1% as we r usng same  Def_Id only na..

and i dnt want the value for Def_Id

in script i hve used

  Def_ClosingDate - Def_DetectOn as Defect_Aging_Days,

     if(Def_ClosingDate - Def_DetectOn <= 1, '1 Day', if(Def_ClosingDate - Def_DetectOn <= 2, '2 Days', if(Def_ClosingDate - Def_DetectOn <= 3, '3 Days','> 3 Days'))) as Defect_Aging_DayBands,

     if(Def_ClosingDate - Def_DetectOn <= 7, '1 Week', if(Def_ClosingDate - Def_DetectOn <= 14, '2 Weeks', '> 2 Weeks')) as Defect_Aging_Weeks,

and i need the

%<=1day to <=3days........

MVP & Luminary
MVP & Luminary

Re: RE:Negative values ?

Not sure why it is wrong.  try

Count(Def_ID)/count(TOTAL Def_ID)


Also check what values you are getting in Age_Bucket field.


Regards,

jagan.

Chanty4u
Esteemed Contributor III

Re: RE:Negative values ?

Hi jagan,

PFA in  that  Days barchart

i wan to display the %values  <=1Days to <=3days  lik dat abve mentioned