<?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: Help in Cumulative Total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2377516#M61329</link>
    <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Is your problem solved, if not, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.&lt;/P&gt;
&lt;P&gt;For problems with totals in your question, you can create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum_Total =
var _table=SUMMARIZE('Date', 'Date' [Month Year],"_value",[Margin Difference Cumlative])
return
IF(HASONEVALUE('Date' [Month Year]),[ Margin Difference Cumlative],SUMX( _table,[_value]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 02:39:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-03-07T02:39:21Z</dc:date>
    <item>
      <title>Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2370756#M60830</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am facing issues with Cumulative Total. Below are the DAX I am using for cumulative total.&lt;/P&gt;&lt;P&gt;I have below table&lt;/P&gt;&lt;P&gt;Week Start Date | Margin | Margin Last Year Week | Difference in Margin&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to take Cumulative of Difference in Margin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Margin is measure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Margin Last Year Week is measure calculated as&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Margin Last Year Week = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Margin]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date'&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Date'[Week Rank]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date'[Week Rank]&lt;/SPAN&gt;&lt;SPAN&gt;)-&lt;/SPAN&gt;&lt;SPAN&gt;52&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Difference in Margin&amp;nbsp; is a measure which is calculated as&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Difference in Margin&amp;nbsp; = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Margin]&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;[Margin Last Year Week]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Date'[Year]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;2022&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Cumulative Total DAX&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Margin Diff Cumulative = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Difference in Margin]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date'&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Date'[Date]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;We have neagative values from March as we don't have data from March 2022 (difference is calculated by taking difference of previous year week from current year week in focus.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so Feb cumulative value should be&amp;nbsp;4997451 +&amp;nbsp;2398854 = 7396305 ( which is coming as 7494045 which is wrong )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to display this Cumulative value in column chart and also I want that it should display till Feb without using any invoice filter as we have data from Jan 2021 to Feb 2022 and data is populated on weekly basis so this graph will gradually increases weekly.&lt;/P&gt;&lt;P&gt;Any help will be appreciated.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 02 Mar 2022 17:35:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2370756#M60830</guid>
      <dc:creator>apatwal</dc:creator>
      <dc:date>2022-03-02T17:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2370866#M60834</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Try to use Year-Week number instead of week number&lt;/P&gt;&lt;P&gt;I know you are filtering only 2022 but I would be more comfortable with slicing by Year-Month instead of Month Name.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 18:27:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2370866#M60834</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-02T18:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2370995#M60843</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;I agree with tamerj on using Yr-Week No.&lt;/P&gt;&lt;P&gt;To get your graph to display correctly you can do your measure like this:&lt;/P&gt;&lt;P&gt;Measure = IF( ISBLANK([Margin], BLANK(), [Incremental Margin Difference]))&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 19:55:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2370995#M60843</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-03-02T19:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2371739#M60879</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had tried using Month Name which is correct showig only filtered data but my cumulative totals are coming wrong.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am calculating margin difference week wise and then taking cumulative month wise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you be more specific where to use Year-Week number; I am confused here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have given below DAX to calculate Week Rank&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Week Rank = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RANKX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date'&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Date'[Week Start Date]&lt;/SPAN&gt;&lt;SPAN&gt;,,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ASC&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DENSE&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Appreciate your response!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 03 Mar 2022 05:38:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2371739#M60879</guid>
      <dc:creator>apatwal</dc:creator>
      <dc:date>2022-03-03T05:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2371766#M60882</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Your measure is&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Margin Last Year Week =
CALCULATE (
    [Margin],
    FILTER ( ALL ( 'Date' ), 'Date'[Week Rank] = MAX ( 'Date'[Week Rank] ) - 52 )
)&lt;/LI-CODE&gt;&lt;P&gt;What is the Week Rank column? Is it the week number from 1 - 52 or a unique number that do not recreate&amp;nbsp;for other years&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 05:59:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2371766#M60882</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-03T05:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2371948#M60896</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Week Rank Column is in Date Table that is a unique number that do not recreate for other years. Below is the DAX used to create Week Rank Column&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Week Rank = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RANKX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date Table'&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Date Table'[Week Start Date]&lt;/SPAN&gt;&lt;SPAN&gt;,,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ASC&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DENSE&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;For Jan 2021&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;For Jan 2022&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if I am doing something wrong here...&lt;/P&gt;&lt;P&gt;As my cumulative values are coming wrong...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 03 Mar 2022 07:08:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2371948#M60896</guid>
      <dc:creator>apatwal</dc:creator>
      <dc:date>2022-03-03T07:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2371989#M60899</link>
      <description>&lt;P&gt;Nothing wrong with that. To fix the total issue:&lt;/P&gt;&lt;P&gt;step 1 replace MAX with MIN and spot any difference in the montly values. If so then you have issues with your data that need to be fixed before moving forward. If nothing change at month level the move to step 2&lt;/P&gt;&lt;P&gt;step2: create a new measure&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Measure =&lt;BR /&gt;SUMX (&amp;nbsp;&lt;/P&gt;&lt;P&gt;VALUES ( Date[Year Month] ),&lt;/P&gt;&lt;P&gt;[Old Measure]&lt;BR /&gt;]&lt;BR /&gt;step3: use the new measure in your visual instead of the old one.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2022 07:30:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2371989#M60899</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-03T07:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2377516#M61329</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Is your problem solved, if not, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.&lt;/P&gt;
&lt;P&gt;For problems with totals in your question, you can create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum_Total =
var _table=SUMMARIZE('Date', 'Date' [Month Year],"_value",[Margin Difference Cumlative])
return
IF(HASONEVALUE('Date' [Month Year]),[ Margin Difference Cumlative],SUMX( _table,[_value]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 02:39:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2377516#M61329</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-07T02:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2378246#M61359</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find the attached PBI Sample file&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1_rjWqkHLG6l7xMud8EifC6BqbMTC1ePK/view?usp=sharing" target="_self"&gt;Sample file&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had calculated weekly difference of Margin and want cumulative sum Month wise.&lt;/P&gt;&lt;P&gt;Let me know if you need any futher information.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 09:26:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2378246#M61359</guid>
      <dc:creator>apatwal</dc:creator>
      <dc:date>2022-03-07T09:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2378346#M61367</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please refer to the sample file with the solution&amp;nbsp;&lt;A href="https://www.dropbox.com/t/D5m4mMmNS3CVhZA1" target="_blank"&gt;https://www.dropbox.com/t/D5m4mMmNS3CVhZA1&lt;/A&gt;&lt;BR /&gt;The measures are&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Difference in Margin = 
SUMX ( 
    VALUES ( 'Date'[Month Year] ),
    CALCULATE ( 
        IF (
            NOT ISBLANK ( SUM ( Margin[Margin] ) ),
            CALCULATE (
                SUM ( [Margin] ) - [Margin Last Year Week],
                'Date'[Year] = 2022
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Margin Diff Cumulative = 
    IF (
        NOT ISBLANK ( [Difference in Margin] ),
        CALCULATE (
            [Difference in Margin],
            REMOVEFILTERS ( 'Date' ),
            'Date'[Date] &amp;lt;= MAX ( 'Date'[Date] )
        )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Mar 2022 09:58:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2378346#M61367</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-07T09:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2381449#M61557</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works perfectly fine for me! Thanks for your help.&lt;/P&gt;&lt;P&gt;But there is some changes which are needed.&lt;/P&gt;&lt;P&gt;If you see in below screenshot, to calculate difference in margin, the last value of Feb 28 is being considered to calculate difference rather than addition of all values.&lt;/P&gt;&lt;P&gt;It should be 195325 - 195462 (total of all Margin Last Year Week for a month)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, if we do not have Margin values then it should not be considered while calculating difference. Like in below, Difference for March month should be 6995.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below DAX is being used to calculate Margin Last year week.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Margin Last Year Week = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Margin]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date Table'&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Date Table'[Week Rank]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date Table'[Week Rank]&lt;/SPAN&gt;&lt;SPAN&gt;)-&lt;/SPAN&gt;&lt;SPAN&gt;52&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 14:20:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2381449#M61557</guid>
      <dc:creator>apatwal</dc:creator>
      <dc:date>2022-03-08T14:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2381692#M61570</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;No it is not working perfectly!&amp;nbsp; Actually all the numbers were wrong as I did not pay attention the first measure [&lt;SPAN&gt;Margin Last Year Week].&lt;BR /&gt;The following should work&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Margin Last Year Week = 
SUMX (
    VALUES ('Date'[Week Rank] ),
    CALCULATE ( 
        IF (
            NOT ISBLANK ( SUM ( Margin[Margin] ) ),
            CALCULATE (
                SUM ( Margin[Margin] ),
                REMOVEFILTERS ( 'Date' ),
                'Date'[Week Rank] = MAX ( 'Date'[Week Rank] ) - 52
            )
        )
    ) 
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Difference in Margin = 
SUMX ( 
    VALUES ( 'Date'[Week Rank] ),
    CALCULATE ( 
        IF (
            NOT ISBLANK ( SUM ( Margin[Margin] ) ),
            CALCULATE (
                SUM ( [Margin] ) - [Margin Last Year Week],
                'Date'[Year] = 2022
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Margin Diff Cumulative = 
SUMX (
    VALUES ('Date'[Week Rank] ),
    CALCULATE (
        IF (
            NOT ISBLANK ( [Difference in Margin] ),
            CALCULATE (
                [Difference in Margin],
                REMOVEFILTERS ( 'Date' ),
                'Date'[Date] &amp;lt;= MAX ( 'Date'[Date] )
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;Still not sure about the blanks issue as my sample data don't have blanks. So please check and let me know. Thank you.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 16:21:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2381692#M61570</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-08T16:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383303#M61673</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;P&gt;In below screenshot you can see that Jan 31 (week start date) is mapped to both Jan and Feb and same for Feb 28 which is mapped to Feb and March.&lt;/P&gt;&lt;P&gt;This is because Jan 31 which is week start date includes Feb month dates. Is there any possibilty that Jan 31 entire week should be entirely mapped to Jan month and same for Feb 28 and for every month end.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, your Cumulative measure does not give correct result it looks it is doing cumulative sum weekly basis but we need cumulative sum on month basis.&lt;/P&gt;&lt;P&gt;If we change VALUES('Date'[Week Rank]') to VALUES('Date'[Month Year]) that would work.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 10:34:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383303#M61673</guid>
      <dc:creator>apatwal</dc:creator>
      <dc:date>2022-03-09T10:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383381#M61677</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Regarding your first concern. Yes this is reasonable because&amp;nbsp;the week that starts on Jan. 31 ends on Feb. 06 and the week that starts on Feb. 28 ends on Mar. 06 therefore both weeks exists&amp;nbsp;in two months. This is also related to the 2nd concern. You are trying to slice by weeks and month at the same time, which is not an easy task. Handling weeks requires extra attention and different approach.&amp;nbsp;&lt;BR /&gt;Now allow me to go back again to your 1st concern. If you remove the Month Year column&amp;nbsp;from the table visual the problem will be solved.&lt;BR /&gt;If you are ok with the then I can update the code so it can decide automatically either to iterate over weeks of over months. Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 11:07:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383381#M61677</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-09T11:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383436#M61680</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is the updated sample file&amp;nbsp;&lt;A href="https://www.dropbox.com/t/zS12j58c8c1BlRNY" target="_blank"&gt;https://www.dropbox.com/t/zS12j58c8c1BlRNY&lt;/A&gt;&lt;BR /&gt;The final measure are&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Margin Last Year Week = 
SUMX (
    VALUES ('Date'[Week Rank] ),
    CALCULATE ( 
        IF (
            NOT ISBLANK ( SUM ( Margin[Margin] ) ),
            CALCULATE (
                SUM ( Margin[Margin] ),
                REMOVEFILTERS ( 'Date' ),
                'Date'[Week Rank] = MAX ( 'Date'[Week Rank] ) - 52
            )
        )
    ) 
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Difference in Margin = 
SUMX ( 
    VALUES ( 'Date'[Week Rank] ),
    CALCULATE ( 
        IF (
            NOT ISBLANK ( SUM ( Margin[Margin] ) ),
            CALCULATE (
                SUM ( [Margin] ) - [Margin Last Year Week],
                'Date'[Year] = 2022
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;Margin Diff Cumulative = 
SUMX (
    VALUES ('Date'[Month Year] ),
    CALCULATE (
        IF (
            NOT ISBLANK ( [Difference in Margin] ),
            CALCULATE (
                [Difference in Margin],
                REMOVEFILTERS ( 'Date' ),
                'Date'[Date] &amp;lt;= MAX ( 'Date'[Date] )
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 11:41:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383436#M61680</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-09T11:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383493#M61682</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;P&gt;I changed my measures as per your guidance but if you see below screenshot, my cumulatives values are taking duplicate values at the month end&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should be as below:&lt;/P&gt;&lt;P&gt;Jan 2022 - 1307920&lt;/P&gt;&lt;P&gt;Feb 2022 - 2297153 (but in above ss, it is +84645 From Jan 31)&lt;/P&gt;&lt;P&gt;Mar 2022 - 2407155 (from above ss, it is +84645 From Jan 31 and +118894 from Feb 28)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the main issue that needs to be resolved.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 12:14:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383493#M61682</guid>
      <dc:creator>apatwal</dc:creator>
      <dc:date>2022-03-09T12:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383539#M61683</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;You are are right as both months are visible in the filter context.&lt;BR /&gt;I don't have this issue in the sample file. I guess I don't have enough data. However, I hope the following code will solve this problem and it will also remove the grand total which has no meaning anyway. Please try and let me know:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Margin Diff Cumulative = 
VAR LastMonthInFilter =
    MAX ('Date'[Month Year] )
VAR IterationTable =
    FILTER ( 
        VALUES ('Date'[Month Year] ),
        'Date'[Month Year] = LastMonthInFilter
    )
RETURN
    SUMX (
        IterationTable,
        CALCULATE (
            IF (
                NOT ISBLANK ( [Difference in Margin] ),
                CALCULATE (
                    [Difference in Margin],
                    REMOVEFILTERS ( 'Date' ),
                    'Date'[Date] &amp;lt;= MAX ( 'Date'[Date] )
                )
            )
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 12:44:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383539#M61683</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-09T12:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383569#M61686</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;P&gt;This had not resolved the issue. Still duplicate value is being taken at the end of month. Please find the below snapshot&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I am pasting DAX which is being used:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Margin Last Year Week = 
    SUMX(
        VALUES('Date'[Week Rank]),
        CALCULATE(
            IF(
                NOT ISBLANK( SUM(Margin)),
                CALCULATE(
                    SUM(Margin),
                    REMOVEFILTERS('Date'),
                    'Date'[Week Rank] = MAX('Date'[Week Rank])-52
                )
            )
        )
    )&lt;/LI-CODE&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;LI-CODE lang="markup"&gt;Difference in Margin = 
    SUMX(
        VALUES('Date'[Week Rank]),
        CALCULATE(
            IF(
                NOT ISBLANK(SUM(Margin)),
                CALCULATE(
                    SUM(Margin) - [Margin Last Year Week],
                    'Date'[Year] = 2022
                )
            )
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Margin Diff Cumulative is the same measure you have shared.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 13:09:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383569#M61686</guid>
      <dc:creator>apatwal</dc:creator>
      <dc:date>2022-03-09T13:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383591#M61689</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you please share the sample updated with at least one more month of data?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 13:20:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383591#M61689</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-09T13:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Cumulative Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383596#M61690</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="355449" data-lia-user-login="apatwal" class="lia-mention lia-mention-user"&gt;apatwal&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you please share the sample updated with at least one more month of data?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 13:23:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-in-Cumulative-Total/m-p/2383596#M61690</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-03-09T13:23:38Z</dc:date>
    </item>
  </channel>
</rss>

