4 Replies Latest reply on Sep 24, 2018 12:12 AM by Mahfooj Khan

# How to add count of the measures and create a "percentage of" field

I have a data set like this:

What I am looking for is this :

To create this I have created three calculated fields "Bounced", "Cleared" and Total. These are the counts in each state for different segments (i.e Commercial Vehicle and Two Wheelers).

In my workbook, I am not able to add those count with a 0's and how to create a "Bounce % of Total" field when both are aggregated field

Formulas :

Bounce = IF [Segment] = "COMMERCIAL VEHICLE" AND [Realisation Status] = "BOUNCED" THEN [Number of Records] END

Cleared = IF [Segment] = "COMMERCIAL VEHICLE" AND [Realisation Status] = "CLEARED" THEN [Number of Records] END

Total = (SUM([CV_Bounce]) + SUM([Realised_CV]))

% of bounce = Bounced / Total

I have also attached the .twbx file for reference.

Thank you so much cheers!!

• ###### 1. Re: How to add count of the measures and create a "percentage of" field

Click on the bottom of the 'Measure Values' card and add this calculation:

COUNT([CV_Bounce ])/[Total]

Format the calculation as a Percentage.

Hope this helps!

1 of 1 people found this helpful
• ###### 2. Re: How to add count of the measures and create a "percentage of" field

Hi,

Find my approach below,

I've changed the logic little bit. Workbook attached for your reference. Let us know if you've any query.

Mahfooj

• ###### 3. Re: How to add count of the measures and create a "percentage of" field

Mahfooz thank you so much, buddy, for the help, but your calculations gave  me the same results,
1. Nulls are not displaying
2. I think taking a 'SUM" is wrong and "COUNT" would be the correct approach.

Warm Regards,

Subhra

• ###### 4. Re: How to add count of the measures and create a "percentage of" field

As per my understanding, I don't think SUM() or COUNT() will matter when you're using tableau generated [Number of Records] measure in your calculation!

However, if COUNT() resulting the correct values then you can go with that!