# QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
Contributor

## Using P() and Weighting/Proportion in Set Analysis

Hi All,

I'd like to use weighting/proportions in set analysis with the P() function to weight the variable used in the possible function.

EXPRESSION - Readmit Rate % for all patients, per coverage selections:

Sum({1<Coverage=P(Coverage)>}[Numerator])/Sum({1<Coverage=P(Coverage)>}[Denominator])

Coverage Type:

A

D

N

E

For example, based on my selections, let's say that the distribution of Coverage Type is the following:

Current Selections Coverage Type Distribution:

A       200

D          0

N    1000

E      100

The P() works to exclude D from the calculation - however, what if I want to weight/use proportions based on the total?

Total Coverage Type Distribution:

A      500

D    2000

N  10000

E      200

Proportion based on Current Selections/Total:

A       200/500=40%

D          0

N    1000/10000=10%

E      100/200=50%

Is there any way to account for these proportions in the expression?

Thanks! 