# New to QlikView

Discussion board where members can get started with QlikView.

Announcements

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

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)&'%'

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!

Community Browser