7 Replies Latest reply on Jun 19, 2018 2:06 AM by Haan Haan

# Calculation field for filter

Hi guys.

I faced some difficulty in creating a calculation field.

For example  I am using EU Superstore data.

What is the calculation field or how to do it if i want:

([Segment for Consumer and Corporate on Sales] / Sales )* 100

Thanks.

• ###### 1. Re: Calculation field for filter

Hi,

(SUM( IF [Segment]="Consumer" or [Segment]="Corporate"

THEN [Sales]

END)/SUM([Sales]))*100

~Tushar

• ###### 2. Re: Calculation field for filter

Dear Tushar

If I want to have a function that it is calculated based on filter of date?

• ###### 3. Re: Calculation field for filter

Sorry I didn't get a gist of your question. Could you please explain.

• ###### 4. Re: Calculation field for filter

Dear Tushar

I mean if I add the order date in the filter and filter it (select certain date). Will the calculation perform accordingly?

Thanks

• ###### 5. Re: Calculation field for filter

Yes. It should work.

• ###### 6. Re: Calculation field for filter

Dear Tushar

Thank you very much!

• ###### 7. Re: Calculation field for filter

Dear Tushar

A question here.

Refer back to this example :

([Segment for Consumer and Corporate on Sales] / Sales )* 100

There are many consumer and corporate on a single day but only one total number of sales that day.

If i do left join, the total number on the single day will duplicate on each consumer and corporate on the particular day...

It will make the Sales to be very big isnt? Or it will not happen? Tableau will only apply the number of total sale on the single day?

Do you get me?