4 Replies Latest reply on Aug 6, 2015 7:46 AM by Ian Burdin

# Calculated field/logical function

Hi all

I want to create a calc field whereby I multiply a particular sales channel by a pre-defined cost or price. For example, for the marketing channels as follows:

Paid search - £0.05

Natural search - £0.00

Social media - £0.05

Display - £0.02

All of the above should be multiplied by number of Visits. For instance, paid search had 2,000, social media had 1,000 and so on.

Aggregator - £0.30  this should be multiplied by number or Orders. So for example 500 orders

Obviously visits and orders are measures that already exist in the workbook. Channel is the dimension I am using for marketing channel

I have tried an IF and THEN statement for example

IF (Channel) = "Aggregator" THEN (Orders)*.3

IF (Channel) = "Paid search" THEN (Visits)*.05

etc

etc

But I am getting error messages...

Many thanks

• ###### 1. Re: Calculated field/logical function

please post error message and a workbook in twbx would be heplful

• ###### 2. Re: Calculated field/logical function

Hi Ian,

You may just be formatting your if statement incorrectly. Try something like this:

IF [Channel] = "Aggregator" THEN [Orders]*.3

ELSEIF [Channel] = "Paid search" THEN [Visits]*.05

ELSEIF [Channel] = "Social media" THEN [Visits]*.05

etc.

END

Cheers,

Will

• ###### 3. Re: Calculated field/logical function

CASE [Channel]

WHEN "Aggregator" THEN [Orders]*.3

WHEN "Paid search" THEN [Visits]*.05

WHEN "Social media" THEN [Visits]*.05

END

• ###### 4. Re: Calculated field/logical function

Thats great many thanks for your help all