<?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: Calculating values based on Date selection from slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-values-based-on-Date-selection-from-slicer/m-p/2903107#M94613</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454927" data-lia-user-login="Happy2023_05" class="lia-mention lia-mention-user"&gt;Happy2023_05&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;If you create a relationship between the calendar table and the fact table, then when you filter the date in the slicer, the data in the fact table in visual will also be filtered. If you don't want the number of data rows in visual to be affected, please try the following method:&lt;/P&gt;
&lt;P&gt;Sample (see sample file attached below)&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(1) create a calendar table&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;calendar = calendar(DATE(2021,1,1),DATE(2022,12,31))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(2) create the measure below&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure1 = 
var _start=MINX(ALLSELECTED('calendar'),[Date])
var _end=MAXX(ALLSELECTED('calendar'),[Date])
var _sum= SUMX(FILTER('Table','Table'[Date]&amp;gt;=_start &amp;amp;&amp;amp; 'Table'[Date]&amp;lt;=_end),[value])
return "date range:"&amp;amp;_start&amp;amp;"-"&amp;amp;_end&amp;amp;": "&amp;amp;_sum&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Tang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, 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>Mon, 14 Nov 2022 08:33:46 GMT</pubDate>
    <dc:creator>v-xiaotang</dc:creator>
    <dc:date>2022-11-14T08:33:46Z</dc:date>
    <item>
      <title>Calculating values based on Date selection from slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-values-based-on-Date-selection-from-slicer/m-p/2899926#M94405</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;I want to calculate values based on date slicer selection.&lt;/P&gt;&lt;P&gt;for eg date slicer 01/02/2022 to 01/05/2022. I need to write DAX. can someone help on this?&lt;/P&gt;&lt;P&gt;for eg calculate(sum(x), date in slicer selection). what DAX function can be used to get this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 10:33:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-values-based-on-Date-selection-from-slicer/m-p/2899926#M94405</guid>
      <dc:creator>Happy2023_05</dc:creator>
      <dc:date>2022-11-11T10:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating values based on Date selection from slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-values-based-on-Date-selection-from-slicer/m-p/2900027#M94409</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;i think you don't need to write any dax.&lt;/P&gt;
&lt;P&gt;You only need to create a relationship between your calendar table and your fact table.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 11:26:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-values-based-on-Date-selection-from-slicer/m-p/2900027#M94409</guid>
      <dc:creator>serpiva64</dc:creator>
      <dc:date>2022-11-11T11:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating values based on Date selection from slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-values-based-on-Date-selection-from-slicer/m-p/2903107#M94613</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="454927" data-lia-user-login="Happy2023_05" class="lia-mention lia-mention-user"&gt;Happy2023_05&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;If you create a relationship between the calendar table and the fact table, then when you filter the date in the slicer, the data in the fact table in visual will also be filtered. If you don't want the number of data rows in visual to be affected, please try the following method:&lt;/P&gt;
&lt;P&gt;Sample (see sample file attached below)&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(1) create a calendar table&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;calendar = calendar(DATE(2021,1,1),DATE(2022,12,31))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(2) create the measure below&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure1 = 
var _start=MINX(ALLSELECTED('calendar'),[Date])
var _end=MAXX(ALLSELECTED('calendar'),[Date])
var _sum= SUMX(FILTER('Table','Table'[Date]&amp;gt;=_start &amp;amp;&amp;amp; 'Table'[Date]&amp;lt;=_end),[value])
return "date range:"&amp;amp;_start&amp;amp;"-"&amp;amp;_end&amp;amp;": "&amp;amp;_sum&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Tang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, 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>Mon, 14 Nov 2022 08:33:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-values-based-on-Date-selection-from-slicer/m-p/2903107#M94613</guid>
      <dc:creator>v-xiaotang</dc:creator>
      <dc:date>2022-11-14T08:33:46Z</dc:date>
    </item>
  </channel>
</rss>

