<?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 Question on Slicer and Cumulative Totals in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Question-on-Slicer-and-Cumulative-Totals/m-p/2203280#M51758</link>
    <description>&lt;P&gt;Hi community, I am a new here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am just getting started with learning Power BI and am using this query as a learning experience to post my first ever question to the forum..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an issue I am working on in a large data set but created very simple version for this query. I can't seem to upload an excel file here so will just some sample rows into a table below to help give the idea, I hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What my goal is to have a Line Chart with the 12 periods on the axis and &lt;EM&gt;&lt;U&gt;cumulative totals&lt;/U&gt;&lt;/EM&gt; as the values. Then I want to have a slicer so I can compare the different countries. I created a Dax Query to calculate the cumulative totals (which is where I suspect my error is)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Cumulative Total = 
CALCULATE(
    SUM(Sheet1[Amount]),
    FILTER(
        ALLSELECTED(Sheet1),
        Sheet1[Period] &amp;lt;= MAX(Sheet1[Period])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However now when I use my slicer I get the combined total of the different all the countries selected. Not the individual countries which is what I am after.&lt;/P&gt;&lt;P&gt;As I say, I suspect it is my DAX query, perhaps the filtering.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone please help, and once again, I am new, please do let me know if I am posting in the wrong place. All advice and help is very welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pete&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example of my dataset follows, In reality I have about 50 countries and 12 periods (for each month) but hopefully this helps to get a general idea..&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;Period&lt;/TD&gt;&lt;TD&gt;Amount&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;51&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;China&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Brazil&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;91&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Greenland&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Mongolia&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;49&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;China&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Greenland&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;44&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Brazil&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;53&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Nov 2021 09:10:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-11-23T09:10:54Z</dc:date>
    <item>
      <title>Question on Slicer and Cumulative Totals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Question-on-Slicer-and-Cumulative-Totals/m-p/2203280#M51758</link>
      <description>&lt;P&gt;Hi community, I am a new here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am just getting started with learning Power BI and am using this query as a learning experience to post my first ever question to the forum..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an issue I am working on in a large data set but created very simple version for this query. I can't seem to upload an excel file here so will just some sample rows into a table below to help give the idea, I hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What my goal is to have a Line Chart with the 12 periods on the axis and &lt;EM&gt;&lt;U&gt;cumulative totals&lt;/U&gt;&lt;/EM&gt; as the values. Then I want to have a slicer so I can compare the different countries. I created a Dax Query to calculate the cumulative totals (which is where I suspect my error is)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Cumulative Total = 
CALCULATE(
    SUM(Sheet1[Amount]),
    FILTER(
        ALLSELECTED(Sheet1),
        Sheet1[Period] &amp;lt;= MAX(Sheet1[Period])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However now when I use my slicer I get the combined total of the different all the countries selected. Not the individual countries which is what I am after.&lt;/P&gt;&lt;P&gt;As I say, I suspect it is my DAX query, perhaps the filtering.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone please help, and once again, I am new, please do let me know if I am posting in the wrong place. All advice and help is very welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pete&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example of my dataset follows, In reality I have about 50 countries and 12 periods (for each month) but hopefully this helps to get a general idea..&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;Period&lt;/TD&gt;&lt;TD&gt;Amount&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;India&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;51&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;China&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Brazil&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;91&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Greenland&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Mongolia&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;49&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;China&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Greenland&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;44&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Brazil&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;53&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 09:10:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Question-on-Slicer-and-Cumulative-Totals/m-p/2203280#M51758</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-23T09:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Slicer and Cumulative Totals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Question-on-Slicer-and-Cumulative-Totals/m-p/2203718#M51780</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , best in such case is to have separate country and period table. Or at least period table, &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then have formulas like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Cumulative Total = 
CALCULATE(
    SUM(Sheet1[Amount]),
    FILTER(
        ALLSELECTED(Period),
        Period[Period] &amp;lt;= MAX(Period[Period])
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take country as legend&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 13:05:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Question-on-Slicer-and-Cumulative-Totals/m-p/2203718#M51780</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-11-23T13:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Slicer and Cumulative Totals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Question-on-Slicer-and-Cumulative-Totals/m-p/2203753#M51784</link>
      <description>&lt;P&gt;Thank you so much,&lt;/P&gt;&lt;P&gt;I am not sure I understand why it worked, but yes it did.&lt;/P&gt;&lt;P&gt;I really appreciate you taking the time to help me. Thank you !!!!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 13:19:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Question-on-Slicer-and-Cumulative-Totals/m-p/2203753#M51784</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-23T13:19:36Z</dc:date>
    </item>
  </channel>
</rss>

