<?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: Calculate LY &amp;amp; LY-1 value for the selected YYYYMM in slicers in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614541#M176593</link>
    <description>&lt;P&gt;A calendar dimension table must be based on dates. Your fact table needs to be modified to contain a date field ( first day of month, for example).&amp;nbsp; Once you join the tables on the date you can use regular time intelligence functions like SAMEPERIODLASTYEAR.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Mar 2025 11:03:56 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2025-03-18T11:03:56Z</dc:date>
    <item>
      <title>Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614355#M176577</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;I have a dim_calendar and fact table. I have used slicers for columns Year(2024) &lt;STRONG&gt;single select&lt;/STRONG&gt; &amp;amp; YYYYMM (202401) &lt;STRONG&gt;multi select&lt;/STRONG&gt;.&lt;BR /&gt;I have YYYYMM column in fact table which is related to dim_calendar. I need to calculate sum of Sales for LY. If I chose 202401, then sales for 202301 should be returned and if there are multi selections then sum of respective months should be displayed. How to achieve this ? If no selection is made then sum of sales for selected year should be displayed. I have also created YYYYMM-1 (202301) &amp;amp; YYYYMM-2 (202201) columns in Dim_calendar. Immediate response would be much appreciated. Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 09:28:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614355#M176577</guid>
      <dc:creator>varung8899</dc:creator>
      <dc:date>2025-03-18T09:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614381#M176579</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="687120" data-lia-user-login="varung8899" class="lia-mention lia-mention-user"&gt;varung8899&lt;/a&gt; Default to Sum of Sales for Selected Year if No Selection: If no YYYYMM is selected, the measure should default to summing the sales for the entire selected year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DAX&lt;BR /&gt;LY Sales = &lt;BR /&gt;VAR SelectedYearMonths = VALUES(dim_calendar[YYYYMM])&lt;BR /&gt;VAR SelectedYear = SELECTEDVALUE(dim_calendar[Year])&lt;BR /&gt;VAR LYYearMonths = &lt;BR /&gt;SELECTCOLUMNS(&lt;BR /&gt;FILTER(&lt;BR /&gt;dim_calendar,&lt;BR /&gt;dim_calendar[YYYYMM] IN SelectedYearMonths&lt;BR /&gt;),&lt;BR /&gt;"LYYYYYMM", dim_calendar[YYYYMM-1]&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;ISBLANK(SelectedYearMonths),&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(fact_table[Sales]),&lt;BR /&gt;dim_calendar[Year] = SelectedYear - 1&lt;BR /&gt;),&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(fact_table[Sales]),&lt;BR /&gt;dim_calendar[YYYYMM] IN LYYearMonths&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;This DAX measure will dynamically calculate the sum of sales for the previous year based on the selected YYYYMM values. If no YYYYMM is selected, it will default to summing the sales for the entire previous year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 09:37:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614381#M176579</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-03-18T09:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614401#M176581</link>
      <description>&lt;P&gt;Thank you. But I receive error stating a table of multiple values was supplied where a single value was expected. Pls advise.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 09:48:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614401#M176581</guid>
      <dc:creator>varung8899</dc:creator>
      <dc:date>2025-03-18T09:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614416#M176583</link>
      <description>&lt;P&gt;Also please note that YYYYMM &amp;amp; related LY columns are in Number format. Below is sample data when I select 2024 and 202401 in slicers. Sum column is from fact table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 09:56:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614416#M176583</guid>
      <dc:creator>varung8899</dc:creator>
      <dc:date>2025-03-18T09:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614442#M176584</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="687120" data-lia-user-login="varung8899" class="lia-mention lia-mention-user"&gt;varung8899&lt;/a&gt;&amp;nbsp;, This must be due to Selected value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LY Sales =&lt;BR /&gt;VAR SelectedYearMonths = VALUES(dim_calendar[YYYYMM])&lt;BR /&gt;VAR SelectedYear = SELECTEDVALUE(dim_calendar[Year])&lt;BR /&gt;VAR LYYearMonths =&lt;BR /&gt;SELECTCOLUMNS(&lt;BR /&gt;FILTER(&lt;BR /&gt;dim_calendar,&lt;BR /&gt;dim_calendar[YYYYMM] IN SelectedYearMonths&lt;BR /&gt;),&lt;BR /&gt;"LYYYYYMM", dim_calendar[YYYYMM-1]&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;ISBLANK(SelectedYearMonths),&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(fact_table[Sales]),&lt;BR /&gt;dim_calendar[Year] = SelectedYear - 1&lt;BR /&gt;),&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(fact_table[Sales]),&lt;BR /&gt;dim_calendar[YYYYMM] IN LYYearMonths&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 10:20:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614442#M176584</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-03-18T10:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614457#M176585</link>
      <description>&lt;P&gt;This is the same formula as before and it does not work unfortunately.&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;Could you please provide your expert advise ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 10:31:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614457#M176585</guid>
      <dc:creator>varung8899</dc:creator>
      <dc:date>2025-03-18T10:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614541#M176593</link>
      <description>&lt;P&gt;A calendar dimension table must be based on dates. Your fact table needs to be modified to contain a date field ( first day of month, for example).&amp;nbsp; Once you join the tables on the date you can use regular time intelligence functions like SAMEPERIODLASTYEAR.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 11:03:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614541#M176593</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-03-18T11:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614561#M176596</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;I have created date column in Fact table now and related it to Dim_calendar. The relation appears as inactive (dotted line) since I&amp;nbsp;already have YYYYMM columns in relationship. Could you please help me frame the DAX ? I am particularly interested for value when single &amp;amp; multiple values are selected in YYYYMM slicer.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 11:20:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614561#M176596</guid>
      <dc:creator>varung8899</dc:creator>
      <dc:date>2025-03-18T11:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614633#M176597</link>
      <description>&lt;P&gt;Remove or inactivate the YYYYMM relationship and activate the date relationship. Use standard DAX.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 12:01:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614633#M176597</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-03-18T12:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614844#M176608</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;. Found the solution using below code. Please help to find LY-1 Sales if you know since I don't see a direct function available for that.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales_LY =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;SelectedYearMonths&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;dim_calendar&lt;/SPAN&gt;&lt;SPAN&gt;[YYYYMM]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;SelectedYear&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;dim_calendar&lt;/SPAN&gt;&lt;SPAN&gt;[Year]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;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;/SPAN&gt;&lt;SPAN&gt;FactData&lt;/SPAN&gt;&lt;SPAN&gt;[Product]&lt;/SPAN&gt; &lt;SPAN&gt;IN&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;SPAN&gt;"Vehicle"&lt;/SPAN&gt;&lt;SPAN&gt;},&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;_SPLY&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;ISBLANK&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;_Output&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;_Output&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Mar 2025 14:24:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4614844#M176608</guid>
      <dc:creator>varung8899</dc:creator>
      <dc:date>2025-03-18T14:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate LY &amp; LY-1 value for the selected YYYYMM in slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4615204#M176621</link>
      <description>&lt;P&gt;Remember that SAMEPERIODLASTYEAR is syntax sugar for DATEADD(x,-12,MONTH). So for LY-1 use SAMEPERIODLASTYEAR(SAMEPERIODLASTYEAR)) or simpler DATEADD(x,-24,MONTH)&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 19:01:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-LY-amp-LY-1-value-for-the-selected-YYYYMM-in-slicers/m-p/4615204#M176621</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-03-18T19:01:50Z</dc:date>
    </item>
  </channel>
</rss>

