Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Percent calculation error

Hi

I have a string in a bar chart like this:

NUM(100-(if([Level 1 Line]='3658' and P2_skär='X',count (distinct (Machine_Skär)))/9)*100,0)&'%'

There are two records where Level 1 Line is 3658

One of the records has an X in P2_skär

In Machine_Skär there is one

I would like my bar to rise to 89% (Machine_Skär/9) but i only get 78%

It seems that the second record without the X is counted in the equation too.

Can anybody see what fault i make?

Best regards

/Mats

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try: NUM (100-(if([Level 1 Line]='3658', count ({<P2_skär={'X'}>} distinct Machine_Skär))/9)*100,0)&'%'

edit: You can include both options if you want x or X: P2_skär={'x','X'}


talk is cheap, supply exceeds demand

View solution in original post

8 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Try this,

     num(count({<[Level 1 line] = {"3658"}, P2_skär= {"X"}>} Distinct Machine_Skär)/9,'#,##0.00%')

Regards,

Kaushik Solanki

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

Hi

Nope, this did not work at all...

It did not separate the Level 1 Line and the percentages is not right.

I will try further

/Mats

Not applicable
Author

upload your sample application

Not applicable
Author

Hi,

to show values in percent may be you are concatenating with % symbol. Which gives wrong percentages.

So in NUM() function instead of 0 use '#,##0.00%'

Not applicable
Author

Hi

In the chart you can see that in Jan the percentages is 67%.

In Jan there are three different Machines but only two are marked with X and therefore the result for Jan should be 78%

Something is not right in the calculation

NUM(100-(if([Level 1 Line]='3658' and P2_skär='X',count (distinct (Machine_Skär)))/9)*100,0)&'%'


2013-03-18 09-46-37.jpg

Gysbert_Wassenaar

Try: NUM (100-(if([Level 1 Line]='3658', count ({<P2_skär={'X'}>} distinct Machine_Skär))/9)*100,0)&'%'

edit: You can include both options if you want x or X: P2_skär={'x','X'}


talk is cheap, supply exceeds demand
Not applicable
Author

Hi

Thanks! This works!

Just one more tiny thing.... If i have a small x, how do i get a detection of that. X or x could be in that cell...

/Mats

Not applicable
Author

Thanks!