<?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: Dynamically Calculated Table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Calculated-Table/m-p/2759232#M85468</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="439913" data-lia-user-login="lundy" class="lia-mention lia-mention-user"&gt;lundy&lt;/a&gt; , You can not create such a calculated table as the calculated table does not use slicer values. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to create a measure and use that with city&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;measure =&lt;/P&gt;
&lt;P&gt;var _1 = int(isfiltered(State[State]), allselected())&lt;/P&gt;
&lt;P&gt;var _2 = countx(allselected(State), State[State])&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;if(_1=1 &amp;amp;&amp;amp; _2 =1, count(City[City]) , blank())&lt;/P&gt;</description>
    <pubDate>Sat, 10 Sep 2022 02:13:29 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-09-10T02:13:29Z</dc:date>
    <item>
      <title>Dynamically Calculated Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Calculated-Table/m-p/2759167#M85460</link>
      <description>&lt;P&gt;I have two tables, State and City.&amp;nbsp; They are related one-to-many with the state column:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;State Table:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;state&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Colorado&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Illinois&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;City Table:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;state&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;city&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Colorado&lt;/TD&gt;&lt;TD&gt;Boulder&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Colorado&lt;/TD&gt;&lt;TD&gt;Ft Collins&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Illinois&lt;/TD&gt;&lt;TD&gt;Champaign&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Illinois&lt;/TD&gt;&lt;TD&gt;Urbana&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a 3rd table called City2.&amp;nbsp; City2 should should be dynamically calculated based on filter context of the State table.&amp;nbsp; If one state from the State table is selected, City2 should include all rows from City which are associated with the selected state.&amp;nbsp; If more than one state is selected, City2 should contain zero rows.&lt;BR /&gt;&lt;BR /&gt;Is this possible, and if so, what would the DAX code look like for City2 ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 23:16:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Calculated-Table/m-p/2759167#M85460</guid>
      <dc:creator>lundy</dc:creator>
      <dc:date>2022-09-09T23:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Calculated Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Calculated-Table/m-p/2759232#M85468</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="439913" data-lia-user-login="lundy" class="lia-mention lia-mention-user"&gt;lundy&lt;/a&gt; , You can not create such a calculated table as the calculated table does not use slicer values. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to create a measure and use that with city&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;measure =&lt;/P&gt;
&lt;P&gt;var _1 = int(isfiltered(State[State]), allselected())&lt;/P&gt;
&lt;P&gt;var _2 = countx(allselected(State), State[State])&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;if(_1=1 &amp;amp;&amp;amp; _2 =1, count(City[City]) , blank())&lt;/P&gt;</description>
      <pubDate>Sat, 10 Sep 2022 02:13:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Calculated-Table/m-p/2759232#M85468</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-09-10T02:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Calculated Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Calculated-Table/m-p/2759297#M85478</link>
      <description>&lt;P&gt;Thank you for your response &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;Just to clarify, Did you mean for your code to look like this?&lt;/P&gt;&lt;P&gt;measure =&lt;BR /&gt;var _1 = int(isfiltered(State[State])) &lt;FONT color="#339966"&gt;//, allselected())&lt;/FONT&gt;&lt;BR /&gt;var _2 = countx(allselected(State), State[State])&lt;BR /&gt;return&lt;BR /&gt;if(_1=1 &amp;amp;&amp;amp; _2 =1, count(City[City]) , blank())&lt;/P&gt;&lt;P&gt;I see that the measure you suggest contains the proper number of City rows when a single State is selected, and that it contains Blank() when multiple States are selected. Thank you for that.&amp;nbsp; What I'm after, however, is for a City Table to be dynamically created based on the filter context of the State table. Not sure how I would accomplish that with the measure you suggest.&amp;nbsp; Is there by chance a suggestion on that?&lt;/P&gt;&lt;P&gt;Possibly you gave me the answer already--"You can not create such a calculated table as the calculated table does not use slicer values.".&amp;nbsp;&amp;nbsp;Is that the case ?&lt;/P&gt;&lt;P&gt;I find myself repeatedly needing this functionality in many projects. What I'm trying to accomplish is to display Facts (Cities in this case) when a single Dimension is selected (ie State), yet hide Facts when multiple Dimensions are selected.&amp;nbsp; An elegant way to accomplish this might be to conditionally hide or display the City Table Visual based on the value of a measure like the one you suggest. This &lt;A href="https://ideas.powerbi.com/ideas/idea/?ideaid=d29f1752-8129-4f50-af85-d336da28cac1" target="_blank"&gt;Microsoft Idea (powerbi.com)&lt;/A&gt; has been proposed for exactly that functionality, but has yet to be accepted by Microsoft.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Interested in your thoughts.&amp;nbsp; Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Sep 2022 04:20:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamically-Calculated-Table/m-p/2759297#M85478</guid>
      <dc:creator>lundy</dc:creator>
      <dc:date>2022-09-10T04:20:43Z</dc:date>
    </item>
  </channel>
</rss>

