
1. Re: help with calculation
Ken Flerlage Sep 20, 2018 12:08 PM (in response to Elvira Giampapa)I'd suggest creating an LOD calculation that will sum up the opportunities by Account. It would look something like this: {FIXED [Account]: SUM([Opportunities])}
Then use that calculated field in your Segment calculated field instead of Opportunities.

2. Re: help with calculation
Michael Gillespie Sep 20, 2018 12:23 PM (in response to Elvira Giampapa)Elvira, let's break down what you want in plain language.
For each Account #, calculate the total number of Opportunities
Based on that number assign a Segment value to the Account #
Correct?
If so, try this. We'll use a Level of Detail (LOD) calculation to force Tableau to sum up the Opportunities at the Account # level.
IF {FIXED [Account #]: SUM([Opportunities])} >= 18
THEN '1'
ELSEIF {FIXED [Account #]: SUM([Opportunities])} < 18
AND {FIXED [Account #]: SUM([Opportunities])} >= 10
THEN '2'ELSEIF {FIXED [Account #]: SUM([Opportunities])} < 10
AND {FIXED [Account #]: SUM([Opportunities])} >= 5
THEN '3'ELSEIF {FIXED [Account #]: SUM([Opportunities])} < 5
THEN '4'ELSE '5'
END
Note that you can combine the > and = in one statement, and you can combine the >= test and the < test into one IF statement.
Try that and see what happens.

3. Re: help with calculation
Elvira Giampapa Sep 21, 2018 1:46 PM (in response to Michael Gillespie)Thanks for your help Michael. I changed the calculation a little but it worked!

4. Re: help with calculation
Michael Gillespie Sep 21, 2018 2:39 PM (in response to Elvira Giampapa)Magnifica! (I hope I've guessed your native language correctly!)
As Ken illustrated, you can simplify the calculation by taking the LOD out and making it a standalone calc, then referencing it in the main calculation.
Glad I could help.
See you in New Orleans! #tc18