# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Contributor

## Need help on calculating percentage

Hello,

I have four rows and want to calculate percentage  on this rows.

Like below

R1

R2

R3

R4

In the R1 means 1st row and R2 means 2nd row............etc

The calculation should be like

(R4/Avg(R1+R2+R3))-1

Can anybody help me on this calculation

Regards,

Kumar

8 Replies
Honored Contributor

## Re: Need help on calculating percentage

*,

(R4/Avg(R1+R2+R3))-1 as R4Perc;

R2,

R3,

R4

from ..

Not applicable

## Re: Need help on calculating percentage

Hi try this,

R2,

R3,

R4,

(R4/Avg(R1+R2+R3))-1 as Percentage

resident abc;

Contributor

## Re: Need help on calculating percentage

These R1,R2............values are actually expressions. Pls see the screen shot.

The %change from average will be calculated like (R4/Avg(R1+R2+R3))-1

Valued Contributor

## Re: Need help on calculating percentage

Hello!

2. only({\$<ID={1}>} your_field)/avg({\$<ID={2,3,4}>} your_field)-1

Contributor

## Re: Need help on calculating percentage

These expressions are coming from more than 2 tables and in which table u want me in corporate this ID column. Can u explain me detail.

Regards,

kumar

MVP

## Re: Need help on calculating percentage

If you are doing this in a chart/table, then use

<expression> - RangeAvg(Above(<expression>, 1, 3))

where <expression> is the expression to which the calculation should be applied.

Make sure that the table is correctly sorted and note that Above(0 automatically turns off interactive sorting

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Contributor

## Re: Need help on calculating percentage

My actual requirement is

Expressions are calculated like

1)  =count(DISTINCT{\$<[Site Visit Hit Source]={"<>5,7,8,9"}, [Site Visit Post Page Event] = {0}>} [Visitor ID])

2) =count(DISTINCT{\$<[Site Visit Hit Source]={"<>5,7,8,9"}, [Site Visit Post Page Event] = {0}>} [Visitor ID]&'_'&[Site Visit Vis Num])

3) =sum({\$<[Site Visit Hit Source]={"<>5,8,9"}, [Site Visit Post Page Event] = {0}>} [Site Visit Record Count])

like that the expressions are coming

if you see that highlighted fx, the value should be calculated like that and i want this one in table chart.

I want to add calculation at end of the table like shown in screen shot.

can u help me on this one.

Regards,

Kumar

Contributor

## Re: Need help on calculating percentage

Hello Experts,

Can anybody help me on this issue.

Regards,

Kumar