6 Replies Latest reply on Sep 16, 2016 11:28 AM by Sreekanth Kasaraneni

If-Else Calculation

I have created a new calculated field using the below formula, and I see the results in the Data Source page.

However, when I pull the newly created 'Team and Calls' filed for chart, it is not showing all the values, it is showing only one value, A/B/C.

The newly calculated 'Team and Calls' should not be coming under measure, it should come as a dimesnsion so that I can use these to understand the nature of sales.

Is there a technique I should follow?

Column Name = Team and Calls

if     [Team_A] > 0 and [Team_B] = 0 and [Team_C] =0  then "A Only"
elseif [Team_B] > 0 and [Team_A] = 0 and [Team_C] =0  then "B Only"
elseif [Team_C] > 0 and [Team_B] = 0 and [Team_A] = 0 then "C Only"

elseif [Team_B] > 0 and [Team_A] >  0 and [Team_C] = 0 then "A and B"
elseif [Team_B] > 0 and [Team_C] > 0  and [Team_A] = 0 then "B and C"
elseif [Team_A] > 0 and [Team_C] > 0 and [Team_B] = 0 then "A and C"

elseif [Team_A] > 0 and [Team_C] > 0 and [Team_B] > 0 then "A/B/C"

elseif [Team_C] = 0 and [Team_B] = 0 and [Team_A] = 0 then "No Sales"

end

• 1. Re: If-Else Calculation

Hi Sathyan,

What are the formulas for Team_A, Team_B and Team_C? If these are measure, it's going to treat the field above as a measure, even though it returns a string.

• 2. Re: If-Else Calculation

There is no formula applied there, that should be the final result if the condition is satisfied.

e.g

if     [Team_A] > 0 and [Team_B] = 0 and [Team_C] =0  then "A Only"

Team_A = Sales from Team A

Team_B = Sales from Team B

Team_C = Sales from Team C

The purpose of newly created column is to tell me from where the sale is coming from.

• 3. Re: If-Else Calculation

In that case, nothing jumps out at me....possible to share the workbook?

• 4. Re: If-Else Calculation

This what I am trying to achieve. First 3 columns are number however the newly created column is String.

 Team A Team B Team C Team and Calls 12 0 0 A Only 0 10 0 B Only 0 0 4 C Only 22 5 0 A and B 0 8 2 B and C 7 0 12 A and C 12 5 9 A/B/C 0 0 0 No Sales
• 5. Re: If-Else Calculation

Well good news and bad news...using the data set above, I copied and pasted your formula exactly and it worked. Not sure why it's breaking on your end.

• 6. Re: If-Else Calculation

The same cal is working for me which you mentioned

see the screen shot below

if the calculation comes into measure drag and drop it in dimensions