4 Replies Latest reply on Sep 30, 2018 10:05 AM by Jim Dehner

# Tableau calculated fields to work like Excel Sumifs

Hi All

I have a sales analysis Dashboard to be made in Tableau for which i need to calculate a 2 metrics based on different dimensions criteria ( in excel that can be done using Sumifs). Now these two metrics would feed into the calculation for 3rd metric.

Any suggestions as to how should i go about replicating sumifs in tableau or any other better way of doing it?

Thanks

• ###### 1. Re: Tableau calculated fields to work like Excel Sumifs

Do you have some example workbook or data.Please attach something along with your expectations  to help you

Thanks

Deepak

• ###### 2. Re: Tableau calculated fields to work like Excel Sumifs

in tableau you would write a formula in the form

if (dimension)= xxx then [measure]  else 0 end

then when you drag it to the viz it will aggregate with sum Tableau and excel are conceptually different -this is a pretty straight forward calculated field that can be more complex based on the actual need

suggest you visit the tableau training site at Tableau Training: View Training Courses and spend some time in the section marked Calculations

JIm

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• ###### 3. Re: Tableau calculated fields to work like Excel Sumifs

Hi Jim

Thanks. I created few calculated fields in the way you suggested above and i also validated their values and they are correct.

Also, i created another field called "organic" using the calculated fields i created above. Its value when i see it alone on workspace is correct but when i use it in a dashboard it automatically becomes a AGG field and values are wrong. any idea why?

Could it be I am not using all the dimensions to create this field and therefore Tableau doesn't know how to aggregate it?

Thanks

• ###### 4. Re: Tableau calculated fields to work like Excel Sumifs

without seeing the book it is only a guess - the measure with"organic" is probably already summed at some level in the raw data - try using min(), Max() or avg to bring it to the viz

JIm