13 Replies Latest reply on Sep 18, 2018 2:59 AM by Nic G

# SUM if condition is met....

Hi

I'd like to Sum the count of Status 0 and 1, as per the below ?

So something like :-

Sum COUNT([Status]) if ([Status]) = 0 or 1

Are there any good sites where I can get my head around this kind of stuff ?

Nicky

• ###### 1. Re: SUM if condition is met....

Any chance you can share a packaged workbook? I'm having a bit of trouble understanding your requirement.

There are a lot of people who write about Tableau, so you can check out some of the many blogs that are our there. And, of course, the forums are a great place--almost no question you have has not already been asked and answered, so you can learn a lot from just searching here.

• ###### 2. Re: SUM if condition is met....

May be You need tHis

{FIXED Player: SUM(IF Status<=1 then CNT(Status) END)}

• ###### 3. Re: SUM if condition is met....

Ken,  very simply I'd like to count where the status is either 0 or 1.

Deepak - when trying that i get error "cannot mix aggregate and non aggregate comparisons or results in 'IF' expression".

Sorry can't upload due to confidential info :-(

• ###### 4. Re: SUM if condition is met....

Anyone able to help me here ?

• ###### 5. Re: SUM if condition is met....

Hi,

~Tushar

• ###### 6. Re: SUM if condition is met....

IS this you are expecting?

SUM({FIXED [Player], Status: COUNT(1) })

• ###### 7. Re: SUM if condition is met....

Tushar

How have you created the count PIL ?

I don't see this in 10.5 - I can use count(status) but when I use that I get the "cannot mix aggregate and non aggregate comparisons or results in 'IF' expression"

• ###### 8. Re: SUM if condition is met....

Chandran,

That calculates Status 0,1,2, I just need 0 and 1.

Anyway to change that count statement to just count those ?

• ###### 9. Re: SUM if condition is met....

Please share a screenshot of what you are writing otherwise we won't come to solution.

~Tushar

• ###### 10. Re: SUM if condition is met....

Here you go.

I need to add Summary Status 0 and 1 together.

calculation2 =  SUM({FIXED [Server Name - Split 1], [Summary Status]:COUNT(1)})

• ###### 11. Re: SUM if condition is met....

Hi Nic,

As said it's difficult to solve the issue just looking at a screenshot. Try the below calculation.

if min([status])=0 or min([status])=1

then [calculation2]

end

or

if attr([status])=0 or attr([status])=1

then [calculation2]

end

~Tushar

• ###### 12. Re: SUM if condition is met....

Hi NIc,

try this formula

SUM({FIXED [Player] : COUNT(IF [Status] = 0 or [Status] = 1 then 1 end)})

Sathish

• ###### 13. Re: SUM if condition is met....

That's it, thank you !