# QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

New Contributor II

## set analysis for total sales

Hi,

i have a requirement where i need total sales of country Inida for year 2014 and total sales of country UK for 2015. Please follow the below details.

ABC:

Year, Country, Sales

2014, IND, 200

2015, IND, 150

2014, UK, 250

2015, UK, 50

];

i want my output only 250.

how can i show this in a single expression. Note only in single set analysis expression.

9 Replies
Partner

## Re: set analysis for total sales

Hi,

Use the following expression:

sum({<Year={2014},Country={'IND'}>+<Year={2015},Country={'UK'}>}Sales)

As a result, you'll get:

Felipe.

Esteemed Contributor III

## Re: set analysis for total sales

may be another way is like

= Rangesum(Sum({<Country = {'IND'}, Year = {2014}>}Sales), Sum({<Country = {'UK'}, Year = {2015}>}Sales))

Use this in your textobject or in straight table expression.

Esteemed Contributor III

## Re: set analysis for total sales

Hi Felip, may be you do not need + before sales right?

Partner

## Re: set analysis for total sales

You do need it if your going to do the addition of set analysis (since he wanted in only one expression).

Example 2:

Sum({\$<Year={2009}>+1<Country={'Sweden'}>} Sales)

This set expression contains the identifiers \$ and 1, the operator + and the modifiers <Year={2009}> and <Country={'Sweden'}>.

### Operators

Operators are used to include, exclude, or intersect parts of or whole data sets. All operators use sets as operands and return a set as result.

This table shows operators that can be used in set expressions.

OperatorDescription
+Union. This binary operation returns a set consisting of the records that belong to any of the two set operands.
New Contributor II

## Re: set analysis for total sales

New Contributor II

## Re: set analysis for total sales

Hey Felip,

Thank you, I did not know that  operators  can also be used in set analysis like this which you have shown in above expression.

Best Regards.

Partner

## Re: set analysis for total sales

Good to know it helped.

Can you mark the correct anwser that helped you so others in the community might see it too?

Thanks

MVP

## Re: set analysis for total sales

This refers to + being a set operator instead of an arithmetic operator like remarked.

So I think the comment is valid that "+Sales" can be replaced by just "Sales" in your expression, right?

hope this helps

regards

Marco

Partner

## Re: set analysis for total sales

Oh right, didnt realise i've put the +Sales at the end, then yes, it's right, there's no need for the plus sign at the end.