Tableau: Average by Dimension
<p>I would like to average <code>N</code> by <code>Type</code> for values of <code>Inst</code></p>

<p>My data is set up as:</p>

<pre><code>Type, Inst, N
A, A1, 4
A, A1, 13
A, A1, 13
A, A2, 4
A, A3, 5
B, B1, 4
B, b2, 10
</code></pre>

<p>So I would like to see a table (or bar chart) with <code>A: 13, B:7</code>. Any suggestions? 
If I put <code>AVG(N)</code> in rows and <code>Type</code> in columns I get <code>A: 7.8, B:7</code></p>

<p>The problem is that Tableau is averaging all <code>N</code> per <code>Type</code>, but I want the numerator to be the total <code>N</code> for the <code>Type</code> while the denominator is the number of unique <code>Inst</code> within that <code>Type</code></p>