<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DAX: calculate dynamic table/rows that update on user slicers in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3218999#M117599</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="554304" data-lia-user-login="theotherside" class="lia-mention lia-mention-user"&gt;theotherside&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The calculation table does not change according to your filtering, try using measure:&lt;/P&gt;
&lt;P&gt;First union the two table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then apply the measure to the table visual:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;QTY Measure = 
var _a = ALLSELECTED('Union Item'[color])
var _b = 
SWITCH(SELECTEDVALUE('Union Item'[item]),
"X",CALCULATE(2*SUM('Union Item'[qty]),FILTER(ALL('Union Item'),[direction]="in"&amp;amp;&amp;amp;[color] in _a)),
"Y",CALCULATE(2*SUM('Union Item'[qty]),FILTER(ALL('Union Item'),[direction]="out"&amp;amp;&amp;amp;[color] in _a)),
SUM('Union Item'[qty]))
return _b&lt;/LI-CODE&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2023 02:21:53 GMT</pubDate>
    <dc:creator>v-jianboli-msft</dc:creator>
    <dc:date>2023-05-04T02:21:53Z</dc:date>
    <item>
      <title>DAX: calculate dynamic table/rows that update on user slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3215516#M117385</link>
      <description>&lt;P&gt;Hi community, this is my first post ever on the forum!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a transformed table named&amp;nbsp;&lt;STRONG&gt;items&amp;nbsp;&lt;/STRONG&gt;(the data below is a mock up simplification to help with posting on a forum, but if I can solve the example below then I can probably solve my real problem)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;transformed table:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;items&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="2" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;&lt;STRONG&gt;item&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;color&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;&lt;STRONG&gt;direction&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;qty&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;a&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;red&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;in&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;b&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;yellow&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;in&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;c&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;blue&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;out&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;d&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;yellow&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;out&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;e&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;yellow&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;out&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;f&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;red&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;in&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;g&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;multicoloured&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;in&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have lots of measures and visuals that help me slice and dice&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;qty&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;by the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;item&lt;/STRONG&gt;,&lt;STRONG&gt;&amp;nbsp;direction&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&amp;amp; c&lt;STRONG&gt;olor&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;columns. That all works great. But I needs these visuals and/or measures to also pick up an additional two rows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;calculated table:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;items2&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="2"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;&lt;STRONG&gt;Item&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;color&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;&lt;STRONG&gt;direction&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;qty&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;X&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;multicoloured&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;in&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;= 2 * sum(items[qty]) where&amp;nbsp;direction='in'&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;multicoloured&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#993300"&gt;out&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;= 2 * sum(items[qty]) where&amp;nbsp;direction&amp;nbsp;= out&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first three columns of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;items2&lt;/STRONG&gt;&amp;nbsp;are hardcoded , the qty column needs to be calculated on the fly. the idea is that I can then create measures such as: combined_qty=items[qty] + items2[qty] (a mix of transfomreand still have the ability to slice and dice by color and direction&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So why don't I just do this with power query, or a DAX calculated column? The reason is because I need the filters applied by the user (via slicers) on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;items&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to impact the calculation of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;items2[qty]&lt;/STRONG&gt;&amp;nbsp;on the fly. For example, if the user filters out red items, then the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;qty&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;value for item&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;X&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;will be 6. (=3 * (2+1))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So why don't i just use measures, which automatically update on the fly with user interaction? The reason is because this returns a scalar value only, and not an entire row, but I need the visuals to be able to filter on items X and Y based on color and direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My last idea was a calculated table, but I got stuck trying to do that as it's a bit above my level of understanding.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is what I'm trying to achieve possible?&lt;BR /&gt;&lt;BR /&gt;Thank you so much in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 11:30:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3215516#M117385</guid>
      <dc:creator>theotherside</dc:creator>
      <dc:date>2023-05-02T11:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: DAX: calculate dynamic table/rows that update on user slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3218999#M117599</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="554304" data-lia-user-login="theotherside" class="lia-mention lia-mention-user"&gt;theotherside&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The calculation table does not change according to your filtering, try using measure:&lt;/P&gt;
&lt;P&gt;First union the two table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then apply the measure to the table visual:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;QTY Measure = 
var _a = ALLSELECTED('Union Item'[color])
var _b = 
SWITCH(SELECTEDVALUE('Union Item'[item]),
"X",CALCULATE(2*SUM('Union Item'[qty]),FILTER(ALL('Union Item'),[direction]="in"&amp;amp;&amp;amp;[color] in _a)),
"Y",CALCULATE(2*SUM('Union Item'[qty]),FILTER(ALL('Union Item'),[direction]="out"&amp;amp;&amp;amp;[color] in _a)),
SUM('Union Item'[qty]))
return _b&lt;/LI-CODE&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 02:21:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3218999#M117599</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2023-05-04T02:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: DAX: calculate dynamic table/rows that update on user slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3236643#M118986</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403972" data-lia-user-login="v-jianboli-msft" class="lia-mention lia-mention-user"&gt;v-jianboli-msft&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your reply it has been incredibly helpful! I am sorry for the delay in my reply to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried your solution. If I use your second screenshot as an example, the QTY Measure is correctly calculating which is great. However what I was hoping is that the total of QTY Measure, rather than being 246, would actually be 738. So in this way the user can filter by whatever columns they like, and not only will the QTY Measure of X and Y update dynamically, but any sum aggregation of QTY Measure will also update dynamically. Is this possible?&lt;BR /&gt;&lt;BR /&gt;I know this is pointless for my colour/direction/qty example, but for my real world application this is crucial.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again!&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 01:48:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3236643#M118986</guid>
      <dc:creator>theotherside</dc:creator>
      <dc:date>2023-05-16T01:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: DAX: calculate dynamic table/rows that update on user slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3236734#M118999</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="554304" data-lia-user-login="theotherside" class="lia-mention lia-mention-user"&gt;theotherside&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;QTY Measure = 
var _a = ALLSELECTED('Union Item'[color])
var _b = SUMX('Union Item',SWITCH([item],
"X",CALCULATE(2*SUM('Union Item'[qty]),FILTER(ALL('Union Item'),[direction]="in"&amp;amp;&amp;amp;[color] in _a)),
"Y",CALCULATE(2*SUM('Union Item'[qty]),FILTER(ALL('Union Item'),[direction]="out"&amp;amp;&amp;amp;[color] in _a)),
CALCULATE(SUM('Union Item'[qty]))))
return _b&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Jianbo Li&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 02:30:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3236734#M118999</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2023-05-16T02:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: DAX: calculate dynamic table/rows that update on user slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3239330#M119142</link>
      <description>&lt;P&gt;Thank you so much this work as expected! Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 03:46:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-dynamic-table-rows-that-update-on-user-slicers/m-p/3239330#M119142</guid>
      <dc:creator>theotherside</dc:creator>
      <dc:date>2023-05-17T03:46:54Z</dc:date>
    </item>
  </channel>
</rss>

