2 Replies Latest reply on Sep 28, 2015 10:26 PM by Swarup K

CALCULATE % FOR 2 COLUMNS

Hello ,

I need help understanding how to write a formula that can calculate % can and % completed in Tableau like it below that I did in excel.

% cancelled and % completed are derived using formula(b2/d2)

Meh

 Count Based on Months QTY Rejected QTY ACCEPTED TOTAL QTY % REJECTED %accepted JAN-15 852 546 1398 60.94% 39.06% FEB-15 722 580 1302 55.45% 44.55% MARCH-15 765 650 1415 54.06% 45.94% APRIL-15 714 651 1365 52.31% 47.69% MAY-15 681 719 1400 48.64% 51.36% JUNE-15 741 860 1601 46.28% 53.72% JULY-15 834 920 1754 47.55% 52.45% TOTAL QTY 5309 4926 10235 51.87%
• 1. Re: CALCULATE % FOR 2 COLUMNS

The answer to this question depends mostly on the structure of your data. If the Excel sheet you show is your data source, then the formulas might look something like this:

Calculated field name: [% Rejected]

Formula: [QTY Rejected]/[TOTAL QTY]

Calculated field name: [% Accepted]

Formula: [QTY ACCEPTED]/[TOTAL QTY]

If your data is the source from which the quantities are derived, then they might look something like this:

sum[Quantity]/total(sum(quantity))

If you could attach a packaged workbook (.twbx) we might be able to offer a more specific example. Please see Posting a Perfect Question, Getting the Most From the Tableau Forums and  Anonymize your Tableau Package Data for Sharing for more information.

• 2. Re: CALCULATE % FOR 2 COLUMNS

Hi Mehul,

Create three calculated fields with the following formulas and try.

Sum: SUM([Qty Accepted])+Sum([QTY Rejected])

Accepted: Sum([Qty Accepted])/[Sum]

Rejected: Sum([QTY Rejected])/[Sum].

Change the default properties of CF.

convert the CF to discrete.