Beast mode using AND and OR

Reply
White Belt

Beast mode using AND and OR

Trying to run sales data to determine how many reps have open opportunities within one of the 5 products as well as of those opportunities which ones have status of closed. I am using this beast mode to find whenever the opportunity status doesn't =  a status thats closed and the item is PBCS then put a 1 so I can sum/count the nuymber

SUM((CASE when ((`Opportunity Status` <> 'closed won' or `Opportunity Status` <> 'lost') and `Item` = 'ARM') then 1 else 0 end)) 

 

Issue is, it is still pulling opportunities with lost and closed won statuses. I have this same beast mode for all 5 items and they are all set as columns which I need to show up with their own distinct values

 

Secondly, I want to reverse it and find when the opportunties are marked closed won statuses to count/sum the number they have closed

 

ultimately need a card that shows total open opps per item by rep vs number of closed by that item

 

thanks!!


Accepted Solutions
AS Black Belt
Black Belt

Re: Beast mode using AND and OR

Are the values correct that we're filtering on?  Like, are the capitalizations correct?  Those are pretty specific strings to match.

Aaron
MajorDomo @ Merit Medical

**Say "Thanks" by clicking the heart in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"
Dojo Admin

Re: Beast mode using AND and OR

@user00617

 

Did the latest replies help you get additional clarity?

Thanks!
Dani

Dani aka "Mr.Dojo"

Dojo Admin
**Say "Thanks" by clicking the "heart" in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"
**You can update your Dojo Community name and avatar by clicking on your avatar then the "My Profile" button.

All Replies
AS Black Belt
Black Belt

Re: Beast mode using AND and OR

How about something like this:

 

SUM(

CASE

WHEN `Item` = 'ARM' AND `Opportunity Status` NOT IN ( 'closed won','lost')

THEN 1

ELSE 0

END)

 

And

 

SUM(

CASE

WHEN `Item` = 'ARM' AND `Opportunity Status` =  'closed won'

THEN 1

ELSE 0

END)

Aaron
MajorDomo @ Merit Medical

**Say "Thanks" by clicking the heart in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"
White Belt

Re: Beast mode using AND and OR

Hmmm still counted all opps no matter what the status. Looks like it is only reading the 'Item' = 'ARM'  and is pulling all opps for that.

AS Black Belt
Black Belt

Re: Beast mode using AND and OR

Are the values correct that we're filtering on?  Like, are the capitalizations correct?  Those are pretty specific strings to match.

Aaron
MajorDomo @ Merit Medical

**Say "Thanks" by clicking the heart in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"
White Belt

Re: Beast mode using AND and OR

Hi Aaron,

 

Circling back to this, do you know how I can make that a filter? I am showing all of the opportunities now per rep but I only want to see when they have 0 opportunities?

 

Thnaks for the help!

Black Belt

Re: Beast mode using AND and OR

You cannot use an aggregate function as a filter. You could sort in ascending order and then the reps with 0 opportunities should be listed first.


______________________________________________________________________________________________
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
______________________________________________________________________________________________
AS Black Belt
Black Belt

Re: Beast mode using AND and OR

@ST_-Superman-_ is correct.  Filtering on aggregations is one of the top-requested features, I would estimate.

Aaron
MajorDomo @ Merit Medical

**Say "Thanks" by clicking the heart in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"
White Belt

Re: Beast mode using AND and OR

Thanks for the help.

 

Are there any work arounds, beastmodes, or any other way that you can think of that would allow me just to show all the 0s (without sorting).

 

Thanks!

AS Black Belt
Black Belt

Re: Beast mode using AND and OR

Sorry, nothing that jumps out in my mind right now.

Aaron
MajorDomo @ Merit Medical

**Say "Thanks" by clicking the heart in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"
Black Belt

Re: Beast mode using AND and OR

I'm wondering if a Windowed function would work for this:

 

SUM(

CASE

WHEN `Item` = 'ARM' AND `Opportunity Status` NOT IN ( 'closed won','lost')

THEN 1

ELSE 0

END)

OVER

(PARTITION BY `Employee Identifier`)

 

You would need to first have the data sorted by the employee identifier field for this to work.  But this would provide a field the I think you could filter on.  Haven't tested this though.  If you have trouble, please provide a sample of your data and I'll see if I can get something working


______________________________________________________________________________________________
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
______________________________________________________________________________________________
Announcements
Check out these great solution videos! The new iSolveditWithDomoboard is live, share yours and earn higher rankings in Dojo click here!