# Calculation logic when using countd

sHi friends,

I would like to calculate the distinct total of all Consumer Segment customer as well as distinct total of all Corporate Segment customer.

Once calculated I would like to add the total.

After that I wanted to calculate the percentage of Consumer Segment customer against all customers for each states.

Please find the attached tableau workbook. I am not understanding why I cannot use the calcuation without segment.

So I want to get a view something like below.

State      % of Consumer segment customers       Total segment customers

BR

• ###### 1. Re: Calculation logic when using countd

Hi

I am on a different version of tableau and you would not be able to open the workbook

There are 3 foruma - see below

The overall result is this - note the Total is a Tableau function on the Analytics tab

Place state on rows to gewt the state level

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• ###### 2. Re: Calculation logic when using countd

Hi Jim,

Thanks. I got the idea. Just to ensure that the second formula with Fixed was for calculating total of all Segment customers right. Should we use other formula so that we can calculate the total without Home Office?

So the second measure should show total excluding Home office. Is there a way to achieve that?

BR

• ###### 3. Re: Calculation logic when using countd

Hi Jim,

I figured it out with if clause,

IF [Segment]= "Consumer" OR [Segment]= "Corporate"

THEN

{ FIXED : COUNTd([Customer Name])}

ELSE

NULL

END

I am still wondering why we it is difficult to solve this the overall issue with simple calculation and not using LOD.

BR