Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
Not applicable

Re: Percent calculation error

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
8 Replies
kaushik_solanki
Not applicable

Re: Percent calculation error

Hi Try this,

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

Regards,

Kaushik Solanki

Not applicable

Re: Percent calculation error

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

Re: Percent calculation error

upload your sample application

Not applicable

Re: Percent calculation error

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

Re: Percent calculation error

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
Not applicable

Re: Percent calculation error

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

Re: Percent calculation error

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

Re: Percent calculation error

Thanks!