# 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.
New Contributor II

## Set Analysis With A Calculation

Hi All,

I have a problem trying to use the set analysis with a calculation include.

My Table is very simple:

ProductFY 1516 FlagBucket 1Bucket 2Bucket 3
10102030
21151010
31555

I would like to make the following calculation but only when the FY 1516 Flag is Set to "1":

=Sum([Bucket 1]) / Sum([Bucket 1] + [Bucket 2] + [Bucket 3])

When I try to do this using a Set Analysis it does not work, however it works if I only try to sum up Bucket 1

Working: Sum( {\$<[FY 1516 Flag]={1}>} [Bucket 1])

Not Working: Sum( {\$<[FY 1516 Flag]={1}>} Sum([Bucket 1]) / Sum([Bucket 1] + [Bucket 2] + [Bucket 3]))

Not Working: Sum( {\$<[FY 1516 Flag]={1}>} [Bucket 1]) / ([Bucket 1] + [Bucket 2] + [Bucket 3]))

Can anyone help?

R

Tags (1)
1 Solution

Accepted Solutions
MVP

## Re: Set Analysis With A Calculation

maybe also

Sum([Bucket 1]) / Sum([Bucket 1] + [Bucket 2] + [Bucket 3]) * [FY 1516 Flag]

2 Replies
MVP

## Re: Set Analysis With A Calculation

Try this:

=Sum({\$<[FY 1516 Flag]={1}>}[Bucket 1]) / Sum({\$<[FY 1516 Flag]={1}>}[Bucket 1] + [Bucket 2] + [Bucket 3])

MVP

## Re: Set Analysis With A Calculation

maybe also

Sum([Bucket 1]) / Sum([Bucket 1] + [Bucket 2] + [Bucket 3]) * [FY 1516 Flag]