<?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: Cumulative sales in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/3984200#M154467</link>
    <description>&lt;P&gt;Just one thing. When I do:&lt;BR /&gt;&lt;BR /&gt;ALL('Dane sprzedaży')&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;it calculates the data for more that is selected in fragmentators. Should I Keepfilters()?&lt;BR /&gt;&lt;BR /&gt;Because I have fragmentators for 'Dane sprzedaży'[Kategoria], 'Dane sprzedaży'[Subkategoria] and then it counts ok. But I also have a fragmentator for the Products and if I select one it stops working.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If I add:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;_cumulativeSales =&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SUMX('Dane sprzedaży';'Dane sprzedaży'[Workers.SprzedażTowaru.Rozchód.Ilość]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;FILTER(ALL('TMiesiące'[Nr miesiąca]);'TMiesiące'[Nr miesiąca]&amp;lt;=_aktualnyMiesiac);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;FILTER(ALL('Dane sprzedaży');'Dane sprzedaży'[Workers.SprzedażTowaru.OkresOperacji.Do].[Rok]=YEAR(now()));&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;FILTER(ALL('Dane sprzedaży');'Dane sprzedaży'[Nazwa]&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;IN&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;VALUES('Dane sprzedaży'[Nazwa]));&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;BR /&gt;&lt;BR /&gt;it works - I just added filter to calculate only for selected Products (Dane sprzedaży [ Nazwa]) but it doesn't work good, at least not always. Is it good way to filter by all selected products?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;wrong calculations:&lt;/P&gt;&lt;DIV class=""&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;In third row we already have a mistake: 260 + 339 +260 should be 859 instead of 851&lt;/DIV&gt;</description>
    <pubDate>Mon, 10 Jun 2024 17:22:23 GMT</pubDate>
    <dc:creator>Fistachpl</dc:creator>
    <dc:date>2024-06-10T17:22:23Z</dc:date>
    <item>
      <title>Cumulative sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/3983828#M154460</link>
      <description>&lt;P&gt;Hello I need to calculate the cumulative sales&lt;BR /&gt;&lt;BR /&gt;On the page I have filters apllied and I just need to calculate the mesaure Sold CY but do it in a cumulative way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First column is a month&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should be:&lt;BR /&gt;Jan 260&lt;BR /&gt;Feb 260 +339&amp;nbsp;&lt;BR /&gt;march 260 + 339 +260 etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to do this by:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cumulative sale =&lt;/P&gt;&lt;P&gt;VAR&amp;nbsp;_aktualnyMiesiac&amp;nbsp;=&amp;nbsp;SELECTEDVALUE('TMiesiące'[Nr miesiąca]) //Current month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR&amp;nbsp;_cumulativeSales&amp;nbsp;=&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;SUMX('Dane sprzedaży';'Dane sprzedaży'[Workers.SprzedażTowaru.Rozchód.Ilość]); // Here sum of Sold items&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;FILTER(ALL('TMiesiące'[Nr miesiąca]);'TMiesiące'[Nr miesiąca]&amp;lt;=_aktualnyMiesiac);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;FILTER('Dane sprzedaży';'Dane sprzedaży'[Workers.SprzedażTowaru.OkresOperacji.Do].[Rok]=2024)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RETURN&amp;nbsp;_cumulativeSales&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it keeps calculating it for each month separately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 14:26:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/3983828#M154460</guid>
      <dc:creator>Fistachpl</dc:creator>
      <dc:date>2024-06-10T14:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/3984022#M154461</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="547299" data-lia-user-login="Fistachpl" class="lia-mention lia-mention-user"&gt;Fistachpl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know your model and context, but you can try below measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Cumulative sale =
VAR _aktualnyMiesiac = SELECTEDVALUE('TMiesiące'[Nr miesiąca]) //Current month
VAR _cumulativeSales =
    CALCULATE(
        SUMX('Dane sprzedaży';'Dane sprzedaży'[Workers.SprzedażTowaru.Rozchód.Ilość]); // Here sum of Sold items
        FILTER(ALL('TMiesiące'[Nr miesiąca]);'TMiesiące'[Nr miesiąca]&amp;lt;=_aktualnyMiesiac);
        FILTER(ALL('Dane sprzedaży');'Dane sprzedaży'[Workers.SprzedażTowaru.OkresOperacji.Do].[Rok]=2024);
        ALL('TMiesiące')
    )
RETURN _cumulativeSales&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 15:41:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/3984022#M154461</guid>
      <dc:creator>xifeng_L</dc:creator>
      <dc:date>2024-06-10T15:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/3984200#M154467</link>
      <description>&lt;P&gt;Just one thing. When I do:&lt;BR /&gt;&lt;BR /&gt;ALL('Dane sprzedaży')&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;it calculates the data for more that is selected in fragmentators. Should I Keepfilters()?&lt;BR /&gt;&lt;BR /&gt;Because I have fragmentators for 'Dane sprzedaży'[Kategoria], 'Dane sprzedaży'[Subkategoria] and then it counts ok. But I also have a fragmentator for the Products and if I select one it stops working.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If I add:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;VAR&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;_cumulativeSales =&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SUMX('Dane sprzedaży';'Dane sprzedaży'[Workers.SprzedażTowaru.Rozchód.Ilość]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;FILTER(ALL('TMiesiące'[Nr miesiąca]);'TMiesiące'[Nr miesiąca]&amp;lt;=_aktualnyMiesiac);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;FILTER(ALL('Dane sprzedaży');'Dane sprzedaży'[Workers.SprzedażTowaru.OkresOperacji.Do].[Rok]=YEAR(now()));&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;FILTER(ALL('Dane sprzedaży');'Dane sprzedaży'[Nazwa]&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;IN&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;VALUES('Dane sprzedaży'[Nazwa]));&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;BR /&gt;&lt;BR /&gt;it works - I just added filter to calculate only for selected Products (Dane sprzedaży [ Nazwa]) but it doesn't work good, at least not always. Is it good way to filter by all selected products?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;wrong calculations:&lt;/P&gt;&lt;DIV class=""&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;In third row we already have a mistake: 260 + 339 +260 should be 859 instead of 851&lt;/DIV&gt;</description>
      <pubDate>Mon, 10 Jun 2024 17:22:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/3984200#M154467</guid>
      <dc:creator>Fistachpl</dc:creator>
      <dc:date>2024-06-10T17:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/3987652#M154570</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="547299" data-lia-user-login="Fistachpl" class="lia-mention lia-mention-user"&gt;Fistachpl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I create a sample table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;First, create a new column to show month number:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MonthNumber = MONTH('Table'[Date])&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then create a new measure and try to use the following dax:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Cumulative Sales = 
CALCULATE(
    SUM('Table'[Sales]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[MonthNumber] &amp;lt;= MAX('Table'[MonthNumber])
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Put this measure in table visual, here is my preview:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A title="https://community.powerbi.com/t5/community-blog/how-to-get-your-question-answered-quickly/ba-p/38490" href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C02%7Cv-yohua%40microsoft.com%7Ce1106bfabecb4734a5cc08dc2305bc51%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638423754744679080%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&amp;amp;sdata=24%2BceC5sFd3n3%2FhFDYILWFcNjCwVClBD%2BPBsSLVfJGk%3D&amp;amp;reserved=0" target="_blank" rel="noopener nofollow noreferrer"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yongkang Hua&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 06:39:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/3987652#M154570</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-12T06:39:30Z</dc:date>
    </item>
  </channel>
</rss>

