i have a table where contains a row of a campaign, objective, and diverse costs by objective and according to the objective (traffic, reach, downloads, leads, etc) i need to generate this cost per objective (cpc,cpm, cpl,cpd), Example.

- OBJECTIVE CPC CPM CPL
- campaig n1 traffic $1.15
- campaig n2 reach $3.43

So i tried to use a calculated field for each objective using conditional IF, but it generates an error due to i used IF and aggregated functions, this is my calculated field.

IF CONTAINS ([objetive], "traffic")

THEN sum[spend]/ sum[clics]

ELSE ""

ENDIF

How can i do this, without a error??