<?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 Help with a DAX Switch (Filter with a Related Table) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-a-DAX-Switch-Filter-with-a-Related-Table/m-p/1836534#M39119</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a DAX function that is working, but I want to extend the logic so its Dynamic rather than hard coded..&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I have a slicer that selects 1 of the 2 options in the table below 'Report up to'&lt;/P&gt;&lt;P&gt;Then a little piece of DAX to feed the Switch Function.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Select Report To = MIN('DimReport To'[Switch])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DAX containing the SWITCH logic&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Report To = 
  SWITCH([Select Report To],
    1, Calculate (sum(FactActualAndPlans[Value]), Filter(FactActualAndPlans, RELATED(DimPeriod[Period End Date]) &amp;lt;= DATE(2020,4,30))) ,
    2, SUM(FactActualAndPlans[Value])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the first option of the switch I need the date of 2020,04,30 to reference the date in the first row of table below called ('DimReport To') that can periodically change. (This date could be placed in a different table if that makes it more simple?)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Period End Date		Switch		Type	                  
28 February 2021	1			Finalised Periods Only	  
31 December 2999	2			All Periods	          &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I have explained it clearly enough...&lt;/P&gt;&lt;P&gt;Thanks in advance for the help of the community!!!&lt;/P&gt;</description>
    <pubDate>Tue, 11 May 2021 15:21:41 GMT</pubDate>
    <dc:creator>DDL1976</dc:creator>
    <dc:date>2021-05-11T15:21:41Z</dc:date>
    <item>
      <title>Help with a DAX Switch (Filter with a Related Table)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-a-DAX-Switch-Filter-with-a-Related-Table/m-p/1836534#M39119</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a DAX function that is working, but I want to extend the logic so its Dynamic rather than hard coded..&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I have a slicer that selects 1 of the 2 options in the table below 'Report up to'&lt;/P&gt;&lt;P&gt;Then a little piece of DAX to feed the Switch Function.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Select Report To = MIN('DimReport To'[Switch])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DAX containing the SWITCH logic&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Report To = 
  SWITCH([Select Report To],
    1, Calculate (sum(FactActualAndPlans[Value]), Filter(FactActualAndPlans, RELATED(DimPeriod[Period End Date]) &amp;lt;= DATE(2020,4,30))) ,
    2, SUM(FactActualAndPlans[Value])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the first option of the switch I need the date of 2020,04,30 to reference the date in the first row of table below called ('DimReport To') that can periodically change. (This date could be placed in a different table if that makes it more simple?)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Period End Date		Switch		Type	                  
28 February 2021	1			Finalised Periods Only	  
31 December 2999	2			All Periods	          &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I have explained it clearly enough...&lt;/P&gt;&lt;P&gt;Thanks in advance for the help of the community!!!&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 15:21:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-a-DAX-Switch-Filter-with-a-Related-Table/m-p/1836534#M39119</guid>
      <dc:creator>DDL1976</dc:creator>
      <dc:date>2021-05-11T15:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a DAX Switch (Filter with a Related Table)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-a-DAX-Switch-Filter-with-a-Related-Table/m-p/1837387#M39159</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="290433" data-lia-user-login="DDL1976" class="lia-mention lia-mention-user"&gt;DDL1976&lt;/a&gt; , Something like this &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SWITCH(True() &lt;BR /&gt;[Select Report To] =1 &amp;amp;&amp;amp; RELATED(DimPeriod[Period End Date]) &amp;lt;= DATE(2020,4,30) , Calculate (sum(FactActualAndPlans[Value]), Filter(FactActualAndPlans, RELATED(DimPeriod[Period End Date]) &amp;lt;= DATE(2020,4,30))) ,&lt;BR /&gt;[Select Report To] = 2, SUM(FactActualAndPlans[Value])&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 03:58:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-a-DAX-Switch-Filter-with-a-Related-Table/m-p/1837387#M39159</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-05-12T03:58:16Z</dc:date>
    </item>
  </channel>
</rss>

