<?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: Month segmentation so that when selecting it, all previous months can be observed (aggregate). in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Month-segmentation-so-that-when-selecting-it-all-previous-months/m-p/3437127#M130436</link>
    <description>&lt;P&gt;What is your expected result when the users select multiple months and/or multiple years ?&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2023 22:18:57 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2023-09-18T22:18:57Z</dc:date>
    <item>
      <title>Month segmentation so that when selecting it, all previous months can be observed (aggregate).</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Month-segmentation-so-that-when-selecting-it-all-previous-months/m-p/3434024#M130239</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a page with two segmentations: Year (2021,2022,2023) and Month (1,2,3,4,5,6,7,8,9,10,11,12). I have several visualizations that depends on DAX measures which work correctly if I select any month or group of months (e.g 2023-01 or 2023-01,02,03,04,05,06,07,08).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to improve the user experience with a&amp;nbsp;&lt;STRONG&gt;segmentation or a button called "YTD"&lt;/STRONG&gt;, that when I select it, what it does is directly&lt;STRONG&gt; filter the entire page with all the months prior to the selected month&lt;/STRONG&gt;. For example if I am visualizing the page with data from 23-08, when selecting this option "YTD", automatically the visualization of the page will be 23-01,02,03,04,05,06,07,08, to see the aggregate. If you had 22-04 checked, what you would see is 22-01,02,03,04. Is like a quick option to avoid selecting each prior month separetly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bookmarks is not an option, it is really messy with so many possible selections.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, any advice is greatful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2023 13:18:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Month-segmentation-so-that-when-selecting-it-all-previous-months/m-p/3434024#M130239</guid>
      <dc:creator>Francisco_MS_PB</dc:creator>
      <dc:date>2023-09-16T13:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Month segmentation so that when selecting it, all previous months can be observed (aggregate).</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Month-segmentation-so-that-when-selecting-it-all-previous-months/m-p/3437127#M130436</link>
      <description>&lt;P&gt;What is your expected result when the users select multiple months and/or multiple years ?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 22:18:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Month-segmentation-so-that-when-selecting-it-all-previous-months/m-p/3437127#M130436</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-09-18T22:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Month segmentation so that when selecting it, all previous months can be observed (aggregate).</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Month-segmentation-so-that-when-selecting-it-all-previous-months/m-p/3437882#M130460</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="618143" data-lia-user-login="Francisco_MS_PB" class="lia-mention lia-mention-user"&gt;Francisco_MS_PB&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you need to create a DimDate table with inactive relation with calendar table to help calculation.&lt;/P&gt;
&lt;P&gt;My Data model:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I suggest you to try code as below to create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _SELECTYEAR =
    SELECTEDVALUE ( 'YearMonthSlicer'[Year] )
VAR _SELECTMONTH =
    SELECTEDVALUE ( 'YearMonthSlicer'[MonthSort] )
VAR _SUM1 =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        USERELATIONSHIP ( 'Calendar'[YearMonth], YearMonthSlicer[YearMonth] )
    )
VAR _SUM2 =
    IF (
        MAX ( 'Calendar'[Year] ) = _SELECTYEAR
            &amp;amp;&amp;amp; MAX ( 'Calendar'[MonthSort] ) &amp;lt;= _SELECTMONTH,
        CALCULATE ( SUM ( 'Table'[Value] ) )
    )
RETURN
    IF ( ISFILTERED ( 'Select'[Button] ), _SUM2, _SUM1 )&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&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;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 08:39:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Month-segmentation-so-that-when-selecting-it-all-previous-months/m-p/3437882#M130460</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-19T08:39:53Z</dc:date>
    </item>
  </channel>
</rss>

