PowerBI / DAX - Row wise division by measure
<p>I am a heavy user of R who is trying to port some basic calculations to Power BI but unable to get DAX to perform vector/rowwise division.</p>
<p>For example, with this dataset:</p>
<pre><code>Category    Value
--------    -----
A           1
A           2
B           3
C           4
</code></pre>
<p>I have created a measure: <code>Value Sum = SUM(Table[Value])</code>
and I would like to create a third column: <code>Value Share = Value / Value Sum</code> to get:</p>
<pre><code>Category    Value    Value Share
--------    -----    -----------
A           1        0.1 
A           2        0.2
B           3        0.3
C           4        0.4
</code></pre>
<p>The equivalent in R would be :</p>
<pre class="lang-r prettyprint-override"><code>table$Value.Share = table$value/Value.Sum
</code></pre>
<p>I have tried: <code>Value Share = [Value] / [Value Sum]</code> but I ended up with 1s in all Value Share rows. Tried <code>SUMX</code> and <code>CALCULATETABLE</code> functions but I believe I am missing something fundamental. Can anyone help?</p>