4 Replies Latest reply: Feb 22, 2017 9:08 AM by Sunny Talwar

# Set Analysis on result current selection

Good morning,

I'm using a chart where I compare the sales per client per Business Unit with the sales per client total.

In my current selections properties I have chosen a particular Business Unit and it gives me a result. I use Set Analysis in a new expression to exclude the 'Business Unit' selection and provide me with the total sales per client.

I'm using this expression:

The problem is: I have two columns. The sales per client per Business Unit (column 1) and the total sales per client (column 2). I want to compare only the sales per business unit/client with the total sales per client where there is a result in column 1. With my current expression I have also results in column 2 where there aren't any sales in column 1.

Is there a simple solution for this problem? I'm a beginner with Qlikview so excuse me if the explanation is a little bit unclear.

Regards,

Timo

• ###### Re: Set Analysis on result current selection

May be just this

If(Column(1) > 0, Sum({<BusinessUnit=>} Sales))

or

Sum({<BusinessUnit=>} Sales) * Avg(1)

• ###### Re: Set Analysis on result current selection

Thank you very much. This was very helpful!

• ###### Re: Set Analysis on result current selection

Is there a simple solution to embed this code into the code beneath. With the code beneath I select last year's sales. How do I add an Set Analysis expression to this?

sum({<Jaar=, Maandnaam={'>=\$(#=AddMonths(min(Maandnaam),-12))  <=\$(#=AddMonths(max(Maandnaam),-12))'}, Maand = ,Dag = >} Sales)

• ###### Re: Set Analysis on result current selection

May be this:

Sum({<Jaar =, Maandnaam = {'>=\$(#=AddMonths(min(Maandnaam),-12))<=\$(#=AddMonths(max(Maandnaam),-12))'}, Maand = , Dag = , BusinessUnit = >} Sales)

or this if you need the same logic of making this 0

Sum({<Jaar =, Maandnaam = {'>=\$(#=AddMonths(min(Maandnaam),-12))<=\$(#=AddMonths(max(Maandnaam),-12))'}, Maand = , Dag = , BusinessUnit = >} Sales) * Avg({<Jaar =, Maandnaam = {'>=\$(#=AddMonths(min(Maandnaam),-12))<=\$(#=AddMonths(max(Maandnaam),-12))'}, Maand = , Dag = >} 1)