# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor

## Calculation in Qlik Sense

Hi All, I have a question and wondering whether you can help me out with this. If I have a field named A which has value A1 and A2. Then I'd like to sum the total sales for A2 only. I have created an IF calculation =if([A]='A2', Sum([Total_sales)])) under the Data --> Expression but the result was dash (-). Could you please point out the mistakes I made? Thanks in advance!
1 Solution

Accepted Solutions
Contributor III

## Re: Calculation in Qlik Sense

If you need only Total sales of A2 then you use the set analysis like:
sum({<A={"A2"}>}[Total_sales])
6 Replies

## Re: Calculation in Qlik Sense

Perhaps this?

Sum(TOTAL {<A={'A2'}>} Total_sales)

In your expression, there is small correction needed

=if([A]='A2', Sum([Total_sales)])) // Remove that

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Contributor III

## Re: Calculation in Qlik Sense

If you need only Total sales of A2 then you use the set analysis like:
sum({<A={"A2"}>}[Total_sales])
New Contributor

## Re: Calculation in Qlik Sense

Hi, thanks for your response. Cool, it works! By the way, I still don't get it and have some questions regarding this, hope you can help me out: 1. About the brackets you use, why should it that much? 2. What the difference between your logic and if it uses TOTAL like @Anil_Babu_Samineni did? Anyway, the result is the same, I'm just wondering about the difference 3. Why can't I use IF like I did before? Thanks before!
Highlighted
New Contributor

## Re: Calculation in Qlik Sense

Hi, thanks for your response. Cool, it works! By the way, I still don't get it and have some questions regarding this as I replied above/below, hope you can help me out. Thanks before!
New Contributor

## Re: Calculation in Qlik Sense

Hi, one more question, if I want to sum the total sales based on 2 conditions, how to add in the another condition? Just use && this sign?
Contributor III

## Re: Calculation in Qlik Sense

You can write the condition within the set analysis using a comma separator. like
sum({<filed1={"cond1"},filed2={"cond2"}>}sales). When you write the expression it is calculated at every row level but if you want to ignore the calculation and get the total of certain dimension you can use the total function. You can search in help.qlik.com.