<?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 Using multiple values from slicer in CALCULATE DAX expression in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-multiple-values-from-slicer-in-CALCULATE-DAX-expression/m-p/2543586#M71714</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a PowerBI dashboard which has a date table connected to a table of student applications.&amp;nbsp; I also have a slicer of academic years.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to be able to capture the multiple selections made on the slicer to be used in further DAX expressions in a CALCULATE statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example: (&lt;EM&gt;psuedo code&lt;/EM&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;VAR selected_years = SELECTEDVALUE('Date'[Academic Years])&lt;/P&gt;&lt;P&gt;VAR calc =&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CALCULATE(COUNT('Student Applications'[Id])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FILTER(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'Date',&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;'Date'[Academic Years] IN selected_years&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;RETURN calc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 May 2022 10:32:42 GMT</pubDate>
    <dc:creator>cwfmoore</dc:creator>
    <dc:date>2022-05-27T10:32:42Z</dc:date>
    <item>
      <title>Using multiple values from slicer in CALCULATE DAX expression</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-multiple-values-from-slicer-in-CALCULATE-DAX-expression/m-p/2543586#M71714</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a PowerBI dashboard which has a date table connected to a table of student applications.&amp;nbsp; I also have a slicer of academic years.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to be able to capture the multiple selections made on the slicer to be used in further DAX expressions in a CALCULATE statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example: (&lt;EM&gt;psuedo code&lt;/EM&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;VAR selected_years = SELECTEDVALUE('Date'[Academic Years])&lt;/P&gt;&lt;P&gt;VAR calc =&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CALCULATE(COUNT('Student Applications'[Id])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FILTER(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'Date',&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;'Date'[Academic Years] IN selected_years&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;RETURN calc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 10:32:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-multiple-values-from-slicer-in-CALCULATE-DAX-expression/m-p/2543586#M71714</guid>
      <dc:creator>cwfmoore</dc:creator>
      <dc:date>2022-05-27T10:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Using multiple values from slicer in CALCULATE DAX expression</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-multiple-values-from-slicer-in-CALCULATE-DAX-expression/m-p/2543751#M71728</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="391122" data-lia-user-login="cwfmoore" class="lia-mention lia-mention-user"&gt;cwfmoore&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR selected_years = VALUES('Date'[Academic Years])&lt;/P&gt;&lt;P&gt;VAR calc =&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CALCULATE(COUNT('Student Applications'[Id])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FILTER(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'Date',&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;'Date'[Academic Years] IN selected_years&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;RETURN calc&lt;BR /&gt;&lt;BR /&gt;If you do SELECTEDVALUE it will only return that value if there is one and for multiple choices will default to blank.&lt;BR /&gt;In general , if you just want to capture the years selcted then you don't need to do anything cause they are already taken by default in the filter context on measures that acts on related table.&lt;BR /&gt;So, for instance, this would have given you the same result:&lt;BR /&gt;&lt;SPAN&gt;COUNT('Student Applications'[Id])&lt;BR /&gt;&lt;BR /&gt;btw, also this would give you the same result per yoor pseudo code:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;VAR selected_years = VALUES('Date'[Academic Years])&lt;/P&gt;&lt;P&gt;VAR calc =&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CALCULATE(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;COUNT('Student Applications'[Id]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;selected_years&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;RETURN calc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Data-Stories-Gallery/Contoso-by-SpartaBI/m-p/2449543" target="_blank" rel="noopener"&gt;&lt;FONT size="4" color="#0000EE"&gt;Showcase Report – Contoso By SpartaBI&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.spartabi.com" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;A href="https://www.linkedin.com/company/spartabi" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt; &amp;nbsp;&amp;nbsp;&lt;A href="https://www.facebook.com/SpartaBI" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.spartabi.com" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 11:54:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-multiple-values-from-slicer-in-CALCULATE-DAX-expression/m-p/2543751#M71728</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-27T11:54:20Z</dc:date>
    </item>
  </channel>
</rss>

