# New to QlikView

Discussion board where members can get started with QlikView.

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

## Set Analysis

Greetings All,

Can you please advise how can I write this  below query in Set analysis in a pivot table:

IF( count(bat_no) > 1, SUM(new), SUM(old))

Many Thanks!

Tags (2)
7 Replies

## Re: Set Analysis

Hi,

Sum(if(aggr(count(Bat_no),Dimension1,Dimension2,..) > 1,New,Old))

Here add the dimensions name which you have included in your chart.

Regards,

Kaushik Solanki

Valued Contributor

## Re: Set Analysis

Hi friend ,

I think it will work for you

=sum(if(count({< bat_no= {'>=1'}>}New,Old)))

regards

Kamal

## Re: Set Analysis

Hi,

Please send us the expected output with some selection.

Regards,

Kaushik Solanki

Not applicable

## Re: Set Analysis

Please find attahced the expected output file.

Valued Contributor II

## Re: Set Analysis

Hi Pihu,

Can I suggest you write out what you wanted to achieve. As often the case, solution to the problem might not require Set Analysis function. If you can explain what the problem is and what you wanted to achieve might be helpful.

Best Regards,

Gabriel

Not applicable

## Re: Set Analysis

Hello,

 Product Pack No Qty1 Qty2 1 1 40 40 2 2 40 10 2 3 40 10 2 4 40 20

According to this table while product count of pack no is equal to 1 then it should be qty1 else qty2.

This is what I need to calculate in a pivot table.

Thanks..!

MVP

## Re: Set Analysis

Hi

Use Product and PackNo as dimension,

Use if(PackNo =1, sum(Qty1), sum(Qty2)) as expression