1
votes

I am trying to create a Calculated Field which returns COUNTD if COUNTD is greater than 1 and returns the field value. So, if there is more than one Company then it will show the number but if only 1, then it will show the company name.

If [Company Count] > 1 then [Company Count] else [Company Name] END

I have tried this I either get an error "Cannot Mix Aggregate and Non-Aggregate comparisons or results in 'If' expressions.

Is this not possible?

2

2 Answers

1
votes

You can also use LOD expression

Company Count= {Fixed :countd([company Name])}

companies= If [Company Count] > 1 then str([Company Count]) else [Company Name] END
1
votes

After some experimenting and further Googling I have found a solution.

if Min([Company Name]) = max([Company Name]) then 
MIN([Company Name]) 
else 
STR([Company Count]) + " Companies" 
END