5 Replies Latest reply on Sep 27, 2018 11:40 PM by Chadi Atie

# How to Combine Two Calculated Fields into One?

Hello guys,

I have the following two calculated fields:

1st Calculated Field:

IF SUM ([Profit])>=100 AND [% of total sales per day]>1 THEN "One"

ELSEIF SUM ([Profit])>=100 AND  [% of total sales per day]<1 THEN "Two"

ELSEIF SUM ([Profit])<100 AND [% of total sales per day]>1 THEN "Three"

ELSE "Four"

END

2nd Calculated Field:

IF SUM ([Profit])>=100 AND [% of total sales per day]>2 THEN "One"

ELSEIF SUM ([Profit])>=100 AND  [% of total sales per day]<2 THEN "Two"

ELSEIF SUM ([Profit])<100 AND [% of total sales per day]>2 THEN "Three"

ELSE "Four"

END

I have a dimension field called Location, which is either "A" or "B"'.

I need to merge the above two calculated fields into just one calculated field following this rule:

When Location is equal to "A", Then do the 1st calculation.

When Location is equal to "B", Then do the 2nd calculation.

Thank you so much for your help,