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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

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.

Labels (1)
1 Solution

Accepted Solutions
sasikanth
Master
Master

hi,

PFA Application

View solution in original post

12 Replies
tresB
Champion III
Champion III

Missing curly brackets.

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

jagan
Partner - Champion III
Partner - Champion III

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.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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
MVP
MVP
Author

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 ?

jagan
Partner - Champion III
Partner - Champion III

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
MVP
MVP
Author

the exp shwng error

Chanty4u
MVP
MVP
Author

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........

jagan
Partner - Champion III
Partner - Champion III

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
MVP
MVP
Author

Hi jagan,

PFA in  that  Days barchart

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