5 Replies Latest reply: May 26, 2017 4:27 AM by Sungwoo Chung

# Conditional Sum

Hi I am a beginner to Qlik Sense.

There is a data set where Sales/Account/Segment/Revenue.  I'm trying to make a sum of revenue from a specific Sales with specific Segment, eg. Sum({<[Sales]={"Name A"}>}{<[Segment]={"Segment A"}>}[Revenue]).  But then it shows the specific Segment, but doesn't filter specific Sales.  From the below example, the answer should be 100.

Sales         Account         Segment         Revenue

Name A     Account A     Segment A     100

Name B     Account B     Segment A     100

Name C     Account C     Segment B     50

Name A     Account D     Segment B     80

Name C     Account E     Segment A     120

But what I got is all from Segment A.  Not sure what I did wrong.  I'd appreciate your advice using Sum.  Also, would it make sense to use Aggr function as well?

Cheers!

• ###### Re: Conditional Sum

Hello Friend,

Your solution is almost good, try this:

=Sum({<[Sales]={"Name A"},[Segment]={"Segment A"}>}[Revenue])

Regards

Jacek.

• ###### Re: Conditional Sum

Hi Jacek, thanks for the reply.  I tried it but it did not give me the result I wanted.

Do you think it's because I put Account as a dimension?  I'm trying to create a chart which shows daily(X-axis) revenue(Y-axis) spending trend by the specific Sales + specific Segment and by Accounts (bars).

Regards,

Sungwoo

• ###### Re: Conditional Sum

Hello,

Regards

Jacek.

• ###### Re: Conditional Sum

Hi Sungwoo,

For example, create table chart. Dimensions [Segment], [Sales], expression Sum(Revenue). Farther, selections in the filters you can get different results (see attached file).

Regards,

Andrey