<?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: Compare current month output against 6 months ago in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-current-month-output-against-6-months-ago/m-p/3669472#M142308</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="283134" data-lia-user-login="debarbanson" class="lia-mention lia-mention-user"&gt;debarbanson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I have created some measures to achieve the effect you are looking for. Following picture shows the effect of the display.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Measures:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;
Percentage = 
VAR _allY =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', 'Table'[Indicator] = "Y" )
    )
VAR _allN =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', 'Table'[Indicator] = "N" )
    )
VAR _allYandN =
    CALCULATE ( SUM ( 'Table'[Sales] ), ALL ( 'Table' ) )
VAR _YPercentage =
    DIVIDE ( _allY, _allYandN )
VAR _NPercentage =
    DIVIDE ( _allN, _allYandN )
RETURN
    IF ( SELECTEDVALUE ( 'Table'[Indicator] ) = "Y", _YPercentage, _NPercentage )


Pervious 6 Month = 
VAR _pervious6Month =
    CALCULATE (
        'Table'[Percentage],
        'Table'[Date] = EOMONTH ( SELECTEDVALUE ( 'Table'[Date] ), -6 )
    )
RETURN
    _pervious6Month&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;to&lt;/STRONG&gt; help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2024 05:27:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-01-31T05:27:42Z</dc:date>
    <item>
      <title>Compare current month output against 6 months ago</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-current-month-output-against-6-months-ago/m-p/3668439#M142245</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I have the following question.&lt;BR /&gt;I have a table (one table) which contains a reporting date (reflected as month end date like 31-1-2023, 28-2-2023 etc) and a field with sales numbers and an indicator Y / N&lt;BR /&gt;&lt;BR /&gt;so in a table reflected as such:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;31-1-2023&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;1000000&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;Y&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;31-1-2023&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;500000&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;N&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28-2-2023&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;1200000&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;Y&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28-2-2023&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;450000&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;N&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc.&lt;BR /&gt;I have a measure which calculates for 31-1-2023 how big Y is out of the total.&lt;BR /&gt;Yes percentage = Divide(Calculate(Sum(tablename[Sales]),Filter(Indicator = "Y"),Sum(tablename[Sales))&lt;BR /&gt;(I might miss out on some () in the above but you get the picture, it's just a sum of all Y divided by everything.&lt;BR /&gt;&lt;BR /&gt;That will give me per reporting month the Y% out of the total.&lt;BR /&gt;What I want to achieve is I want to compare the Y% against 6 months ago.&lt;BR /&gt;So e.g. my reporting date is 31-12-2023 and the Y% is 5%, in a column next to it I want to show the Y% per 30-6-2023.&lt;BR /&gt;Similarly 30-11-2023 Y% should have next to it a column with the 31-5-2023 Y percentage.&lt;BR /&gt;&lt;BR /&gt;I tried this with using DateAdd(Reportingdate, -6, Month) however I only get results for the months December, October, August, July, May, while my dataset runs from November 2022-December 2023. Of course I would expect no values for the months November 2022 until April 2023 since there is nothing to compare against but as of May 2023 I would expect an outcome for all months after. But for one reason or another some months do not show up.&lt;BR /&gt;&lt;BR /&gt;Most likely it has to do with some months having 31 days and others 30 but I am a bit in the dark. Anyone has a nice solutions for this? Any help or insights are much appreciated!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 15:35:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-current-month-output-against-6-months-ago/m-p/3668439#M142245</guid>
      <dc:creator>debarbanson</dc:creator>
      <dc:date>2024-01-30T15:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compare current month output against 6 months ago</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-current-month-output-against-6-months-ago/m-p/3669405#M142301</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="283134" data-lia-user-login="debarbanson" class="lia-mention lia-mention-user"&gt;debarbanson&lt;/a&gt; , You should use date table is such case joined with date of your table. Period from date table should be used in Visual, Measure and Slicer/filter &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;calculate([Yes percentage], dateadd(Date[Date], -6 month)) &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :&lt;A href="https://youtu.be/OBf0rjpp5Hw" target="_blank"&gt;https://youtu.be/OBf0rjpp5Hw&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4" target="_blank"&gt;https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4&lt;/A&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :&lt;A href="https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions" target="_blank"&gt;radacad&lt;/A&gt; &lt;A href="https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/" target="_blank"&gt;sqlbi&lt;/A&gt; &lt;A href="https://www.youtube.com/playlist?list=PLPaNVDMhUXGYLz-w8ERQOo3KYARs7GgG-" target="_blank"&gt;My Video Series&lt;/A&gt; Appreciate your Kudos. &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 03:53:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-current-month-output-against-6-months-ago/m-p/3669405#M142301</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2024-01-31T03:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Compare current month output against 6 months ago</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-current-month-output-against-6-months-ago/m-p/3669472#M142308</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="283134" data-lia-user-login="debarbanson" class="lia-mention lia-mention-user"&gt;debarbanson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I have created some measures to achieve the effect you are looking for. Following picture shows the effect of the display.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Measures:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;
Percentage = 
VAR _allY =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', 'Table'[Indicator] = "Y" )
    )
VAR _allN =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', 'Table'[Indicator] = "N" )
    )
VAR _allYandN =
    CALCULATE ( SUM ( 'Table'[Sales] ), ALL ( 'Table' ) )
VAR _YPercentage =
    DIVIDE ( _allY, _allYandN )
VAR _NPercentage =
    DIVIDE ( _allN, _allYandN )
RETURN
    IF ( SELECTEDVALUE ( 'Table'[Indicator] ) = "Y", _YPercentage, _NPercentage )


Pervious 6 Month = 
VAR _pervious6Month =
    CALCULATE (
        'Table'[Percentage],
        'Table'[Date] = EOMONTH ( SELECTEDVALUE ( 'Table'[Date] ), -6 )
    )
RETURN
    _pervious6Month&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;to&lt;/STRONG&gt; help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 05:27:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-current-month-output-against-6-months-ago/m-p/3669472#M142308</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-31T05:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Compare current month output against 6 months ago</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-current-month-output-against-6-months-ago/m-p/3672288#M142459</link>
      <description>&lt;P&gt;Many thanks for this, I only had to use the last part of your code for the previous 6 months part and that worked like a charm. Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 07:38:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-current-month-output-against-6-months-ago/m-p/3672288#M142459</guid>
      <dc:creator>debarbanson</dc:creator>
      <dc:date>2024-02-01T07:38:05Z</dc:date>
    </item>
  </channel>
</rss>

