
1. Re: Help on Calculated field (Like CountIF in Excel)
Adam Crahen Dec 15, 2015 9:50 AM (in response to Suman Inampudi)Try this:
max([Qty])/count([Code])

2. Re: Help on Calculated field (Like CountIF in Excel)
Suman Inampudi Dec 15, 2015 10:16 AM (in response to Adam Crahen)Thank you for looking into this.
I tried the same, but i am getting the same number as result.
When you do max(qty)/count (code) > i am getting same number: 100/1 = 100, 100/1 =100, 210/1=210 etc....
Am i doing something wrong here?
Please advice..

3. Re: Help on Calculated field (Like CountIF in Excel)
puspak Agasti Dec 15, 2015 10:05 AM (in response to Suman Inampudi) 
4. Re: Help on Calculated field (Like CountIF in Excel)
Shawn Wallwork Dec 15, 2015 10:06 AM (in response to Suman Inampudi)To get the output you are looking for you'll have to have an ID type field to keep Tableau from aggregating you Codes. Then you'll need to use an EXCLUDE LOD expression to back that ID out to get the math to work:
In the future if you post a packaged work book (instead of a table) and mention what version of Tableau you are using, we can better help you. I'm not posting this workbook because it is in 9.2, and I wasn't sure you'd be able to open it.
Cheers,
Shawn

5. Re: Help on Calculated field (Like CountIF in Excel)
Shawn Wallwork Dec 15, 2015 10:18 AM (in response to Suman Inampudi)See the other replies for the answer.
Shawn

6. Re: Help on Calculated field (Like CountIF in Excel)
Suman Inampudi Dec 15, 2015 11:12 AM (in response to puspak Agasti)Thank you Agasti,
Initially i didn't get right. But when i use this formula it's perfect.
[Qty]/{fixed [Code]: count([Code])}
Instead of qty, i used Code in fixed function
Thanks,
Suman