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,

• ###### 1. Re: How to Combine Two Calculated Fields into One?

Guess you need to do like above.

Thanks,

Ritesh

• ###### 2. Re: How to Combine Two Calculated Fields into One?

Hello Ritesh,

It is giving me Null value only.

Thanks

• ###### 3. Re: How to Combine Two Calculated Fields into One?

Not giving me the Null value

May  be you need to attach your workbook.

I have attached mine , may be your condition is fetching NULL here

Thanks,

Ritesh

• ###### 5. Re: How to Combine Two Calculated Fields into One?

I did the same just like you

Maybe it is because inside my calculation 1 and 2,  I am using also some calculated fields? or this have nothing to do?

Thanks,