8 Replies Latest reply on Aug 29, 2018 9:00 PM by Naveen B

# COUNTD on a Calculated Field in my dataset

Hello,

I've got a dataset that is like this

NameType
BanjoDog
GeorgeDog
JackCat

Basically I want to add an extra column as a Calculated Field where I can count the number of dogs, cats, in each type, so basically a COUNTD on Name with an IF (Type = Type of this row)

NameTypeCOUNTD
BanjoDog2
GeorgeDog2
JackCat1

How could I accomplish this? Sounds very trivial in my head but I've been stuck a good while.

I know it would be better most likely to not add it as column, but in this case it's what I need for a short term solution.

Cheers,

• ###### 1. Re: COUNTD on a Calculated Field in my dataset

Hi Pablo,

Create this calculated field.

Place it on text and edit.

Select following.

Hope that helps.

~Tushar

• ###### 2. Re: COUNTD on a Calculated Field in my dataset

You can also do this by LOD.

{ FIXED [Type]:SUM([Number of Records])}

~Tushar

• ###### 3. Re: COUNTD on a Calculated Field in my dataset

Hi Pablo,

Create a calculation like below

Hope this helps

Kindly mark this answer as correct and helpful so that it will help others

BR,

NB

• ###### 4. Re: COUNTD on a Calculated Field in my dataset

Hello Pablo,

You can try below logic:

{Fixed [Type] : SUM([Number of Records])}

• ###### 5. Re: COUNTD on a Calculated Field in my dataset

Sorry I was not crystal clear in my initial post, Important to say that I would like to count DISTINCT dogs, meaning the number of unique names in the type of that row.

• ###### 6. Re: COUNTD on a Calculated Field in my dataset

COUNTD(Type) Will do

• ###### 7. Re: COUNTD on a Calculated Field in my dataset

That worked I think!

Is there any way I can make it a non-aggregation metric? Meaning it would show in my Data Source tab instead of appearing as undefined. I want to "Hardcode" this calculation in the data.

• ###### 8. Re: COUNTD on a Calculated Field in my dataset

Click on Field --> Convert to Discrete you will get the values like 1,2,3

BR,

NB