Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
polisetti
Creator II
Creator II

Set analysis

Hi,

I have a pivot table as shown below. I need the sales in the sales column, but in the total row, i need only the sum of products having flag=x. Can anyone suggest some expression for the same.

ProductFlagSales
Ax10
Bx20
Cy40
Total 30

If we write an expression for sales as sum(sales) where flag is minimum, the total row will consider only flag=x and I will be able to get the sales across each product as well.

Any suggestions for the expression?

Regards,

Pollisetti

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Try something like:

if(dimensionality()=0, sum({<Flag = {'x'}>}Sales), sum(Sales))

Hope this helps!

View solution in original post

6 Replies
joshabbott
Creator III
Creator III

=sum(<flag={'x'}>sales)

The value wouldn't show for the 'y' flag, but the others should show 10 and 20 respectively with a total of 30 for the 2nd expression column

jerem1234
Specialist II
Specialist II

Try something like:

if(dimensionality()=0, sum({<Flag = {'x'}>}Sales), sum(Sales))

Hope this helps!

polisetti
Creator II
Creator II
Author

I want the value to be shown for Y as well but not to be considered in total

polisetti
Creator II
Creator II
Author

can u suggest me the expression to calculate:

sum(flag=min(flag) sales)

jerem1234
Specialist II
Specialist II

Something like:

sum({<Flag={$(=min(Flag))}>}Sales)

Not applicable

I can think of a lengthy workaround.

1. Create expression containing the basic sales - Expr1

= sales // Total here becomes null

2. Create second expression - Expr2

= sum(if(min(all flag) = flag,sales)) // Total here is sum of sales where flag is min

3. Create third expression which is based on first two

= if( Expr2 = 0, Expr1, Expr2) // This will give the column that you need

4. Hide the first two expressions.(option available in Presentation tab of chart properties)