4 Replies Latest reply on Aug 16, 2018 12:21 AM by Martin Asztalos

# Excel's "CountIfs" in Tableau with String Comparison

Hi,

I am trying to mimic the Excel formula "CountIfs" in combination with an If statement in a calculated field.

I found  some discussions here regarding "CountIfs" but not the answer I was looking for.

My aim is to find for each FilterGroup if it has a FilterWW value of "Last WW".

If a FilterGroup does have a value of "Last WW" then the result should be ok otherwise it is bad.

How can I mimic this Excel formula in Tableau?

And how can I write the formula in order to get the "ok" or "bad" as a string (this makes it easy to filter)?

• ###### 1. Re: Excel's "CountIfs" in Tableau with String Comparison

Hi Martin,

Write  calculation like below it will give the required output

Hope this helps kindly mark this answer as correct or helpful so that it will help others

BR,

NB

1 of 1 people found this helpful
• ###### 2. Re: Excel's "CountIfs" in Tableau with String Comparison

HI Martin,

You can achieve this by using LOD function:

if ({FIXED [Filter Group]:max(if [Filter WW]="Last WW" then 1 ELSE 0 END)})=1 then "Ok" ELSE "bad" END

1 of 1 people found this helpful
• ###### 3. Re: Excel's "CountIfs" in Tableau with String Comparison

Hi Martin,

Please have a look at the attached workbook and see if this is what you wanted.

Thanks,

1 of 1 people found this helpful
• ###### 4. Re: Excel's "CountIfs" in Tableau with String Comparison

Hi Naveen, Meenu, Borja,

Sorry that it took so long to reply.

All works fine - thanks.

Martin