4 Replies Latest reply on May 20, 2013 7:04 AM by Mubbasher Khaliq

# How can I write an expression to get total sale of all the products while in dimension only one product has been selected .

Like I have selected only 'A' product so I want two measures in a combo chart i.e.

Sale : Sum(Sale) it will give 3

Total Sale : here I want sum of all the sales which should give 78

Category     Sub-Category     Sale

=========================

A                        a                  1

A                        b                  2

B                        a                  3

B                        b                  4

C                        a                  5

C                        b                  6

D                        a                  7

D                        b                  8

E                        a                  9

E                        b                  10

F                        a                  11

F                        b                  12

==========================

Is there any way to do that?

• ###### 1. Re: How can I write an expression to get total sale of all the products while in dimension only one product has been selected .

Are you filtering Category? There are absolutely ways of getting what you want.

• ###### 2. Re: How can I write an expression to get total sale of all the products while in dimension only one product has been selected .

Yes I am filtering over Category and have selected 'A' Product category.

• ###### 3. Re: How can I write an expression to get total sale of all the products while in dimension only one product has been selected .

See the attached - we can use total(sum([sales])) to get the total accross all (set to Table Down), but the filtering still breaks this.

We use a special filter that 'tricks' Tableau into returning all of the rows for the total on sheet 2.

1 of 1 people found this helpful
• ###### 4. Re: How can I write an expression to get total sale of all the products while in dimension only one product has been selected .

Thanks Alex ,

It is working fine now but here is something more I need from you , I appreciate your cooperation.

When Sub-Category is on X-Axis it should group data to sub-category:

Sale(a) : 1

Sale(b) : 2

Total Sale(a) : 36

Total Sale(b) : 42

Here in place of total sale it gives me 78 , may be it is not grouping data to sub - category so how can I do that in my measure?