# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Contributor II

## Division Calculation in expression

Hi All,

I want expression to be written in Guage for calculating Profitability with given parameters -

Where

Profit is - P1,P2,P3....Pn

Value is - V1,V2,V3....Vn

Guage should calculate - Profitability -

(P1+P2+P3+....+Pn) / (V1+V2+V3+...+Vn)

div(Sum(Profit),Sum(value)) is not working in expression

Thanks,

Vikas

1 Solution

Accepted Solutions
Contributor II

## Re: Division Calculation in expression

I got it

Sum(Profit)/Sum(Value) gave me the desired answer.

Thanks for the help.

19 Replies

## Re: Division Calculation in expression

You said P1, P2, P3 ... Pn. But all are string or numbers

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Contributor II

## Re: Division Calculation in expression

@Anil,

Its a table where P1, P2 P3 are Profit numbers for Item1, Item2, Item3... Itemn corresponding to Final Value of V1, V2 V3

Highlighted

## Re: Division Calculation in expression

Can you show data please how profit and and value looks?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Contributor II

## Re: Division Calculation in expression

 Item Type value Profit Low Makeable C 1,302.40 78.10 Cubes M 1,178.10 94.20 Cubes M 2,077.50 145.40 Cubes M 3,945.92 315.70 Cubes M 1,952.50 156.20 High Makeable M 509.86 56.10 High Makeable M 3,063.95 76.60 High Makeable M 1,105.56 71.90 Blacks M 1,385.00 13.90 Blacks M 2,552.00 25.50 Blacks M 1,488.36 14.90

## Re: Division Calculation in expression

Seems working

Or

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Valued Contributor

## Re: Division Calculation in expression

Hi are you expecting like this in Guage chart

Contributor II

## Re: Division Calculation in expression

Yes I am expecting this calculation

But when i put the below expression in Qlik sense,

Div(Sum(Profit),Sum(value))

the calculated field shows "0"

Contributor II

NO

## Re: Division Calculation in expression

Seems, Qliksense also working

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)