<?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: How to Calculate the Sum/count till selected date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-the-Sum-count-till-selected-date/m-p/2979012#M99827</link>
    <description>&lt;P&gt;To create a cumulative sum in DAX (Data Analysis Expression) language, you can use the SUMX function, which iterates over a table and calculates a running sum of the expression provided.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, to calculate a cumulative sum of the "Value" column for a table with the input columns "Name", "Type", and "Valueupdateddate", you could use the following DAX formula:&lt;/P&gt;&lt;P&gt;CumulativeSum = SUMX ( FILTER ( TableName, TableName[Valueupdateddate] &amp;lt;= MAX ( TableName[Valueupdateddate] ) ), TableName[Value] )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This formula filters the table to only include rows with a "Valueupdateddate" less than or equal to the maximum "Valueupdateddate" in the table, and then calculates a running sum of the "Value" column.&lt;/P&gt;&lt;P&gt;If you want to further filter the table by a specific date range, such as July 2022, you can modify the formula to include an additional filter on the "Valueupdateddate" column, like this:&lt;/P&gt;&lt;P&gt;CumulativeSum = SUMX ( FILTER ( TableName, TableName[Valueupdateddate] &amp;lt;= MAX ( TableName[Valueupdateddate] ) &amp;amp;&amp;amp; TableName[Valueupdateddate] &amp;gt;= DATE ( 2022, 7, 1 ) &amp;amp;&amp;amp; TableName[Valueupdateddate] &amp;lt;= DATE ( 2022, 7, 31 ) ), TableName[Value] )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This formula filters the table to only include rows with a "Valueupdateddate" in July 2022, and then calculates a running sum of the "Value" column.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2022 12:38:07 GMT</pubDate>
    <dc:creator>MAwwad</dc:creator>
    <dc:date>2022-12-20T12:38:07Z</dc:date>
    <item>
      <title>How to Calculate the Sum/count till selected date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-the-Sum-count-till-selected-date/m-p/2978877#M99810</link>
      <description>&lt;P&gt;&amp;nbsp;I am trying to write a dax to calculate sum of the records. But the sum only takes the latest record for each "Name"&lt;/P&gt;&lt;P&gt;Example :&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have input as 3 columns Name, Type and Valueupdateddate&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;For CP123, Value updated date = 20 Jan 2021, type = manual , and it changed in Feb 2022 i.e, type=automatic , so when calculated for Jan 2022 it should still consider the "Type"&amp;nbsp; as manual as at that point in time the "Type" was manual.&lt;/P&gt;&lt;P&gt;When I select filter as July 2022. My output table should be. So it should also consider the values if the type has changed.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help!.&lt;/P&gt;&lt;P&gt;Thanks&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 15:38:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-the-Sum-count-till-selected-date/m-p/2978877#M99810</guid>
      <dc:creator>Pranali_R</dc:creator>
      <dc:date>2022-12-20T15:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to Calculate the Sum/count till selected date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-the-Sum-count-till-selected-date/m-p/2979012#M99827</link>
      <description>&lt;P&gt;To create a cumulative sum in DAX (Data Analysis Expression) language, you can use the SUMX function, which iterates over a table and calculates a running sum of the expression provided.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, to calculate a cumulative sum of the "Value" column for a table with the input columns "Name", "Type", and "Valueupdateddate", you could use the following DAX formula:&lt;/P&gt;&lt;P&gt;CumulativeSum = SUMX ( FILTER ( TableName, TableName[Valueupdateddate] &amp;lt;= MAX ( TableName[Valueupdateddate] ) ), TableName[Value] )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This formula filters the table to only include rows with a "Valueupdateddate" less than or equal to the maximum "Valueupdateddate" in the table, and then calculates a running sum of the "Value" column.&lt;/P&gt;&lt;P&gt;If you want to further filter the table by a specific date range, such as July 2022, you can modify the formula to include an additional filter on the "Valueupdateddate" column, like this:&lt;/P&gt;&lt;P&gt;CumulativeSum = SUMX ( FILTER ( TableName, TableName[Valueupdateddate] &amp;lt;= MAX ( TableName[Valueupdateddate] ) &amp;amp;&amp;amp; TableName[Valueupdateddate] &amp;gt;= DATE ( 2022, 7, 1 ) &amp;amp;&amp;amp; TableName[Valueupdateddate] &amp;lt;= DATE ( 2022, 7, 31 ) ), TableName[Value] )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This formula filters the table to only include rows with a "Valueupdateddate" in July 2022, and then calculates a running sum of the "Value" column.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 12:38:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-the-Sum-count-till-selected-date/m-p/2979012#M99827</guid>
      <dc:creator>MAwwad</dc:creator>
      <dc:date>2022-12-20T12:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to Calculate the Sum/count till selected date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-the-Sum-count-till-selected-date/m-p/2979457#M99855</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="447406" data-lia-user-login="MAwwad" class="lia-mention lia-mention-user"&gt;MAwwad&lt;/a&gt;&amp;nbsp;It is not a cumulative sum ..If you see the output, it is not increasing, if the type changes, the number decreases.&lt;/P&gt;&lt;P&gt;Here is the sample data.&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;Value_Updated Date&lt;/TD&gt;&lt;TD&gt;Latest Record?&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CP123&lt;/TD&gt;&lt;TD&gt;Manual&lt;/TD&gt;&lt;TD&gt;20-Jan-21&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CP123&lt;/TD&gt;&lt;TD&gt;Automatic&lt;/TD&gt;&lt;TD&gt;21-Feb-22&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CP124&lt;/TD&gt;&lt;TD&gt;Manual&lt;/TD&gt;&lt;TD&gt;20-Jan-21&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CP124&lt;/TD&gt;&lt;TD&gt;Automatic&lt;/TD&gt;&lt;TD&gt;05-Apr-22&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CP124&lt;/TD&gt;&lt;TD&gt;Manual&lt;/TD&gt;&lt;TD&gt;07-Apr-22&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CP130&lt;/TD&gt;&lt;TD&gt;Manual&lt;/TD&gt;&lt;TD&gt;17-Oct-21&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CP130&lt;/TD&gt;&lt;TD&gt;Automatic&lt;/TD&gt;&lt;TD&gt;01-Dec-21&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CP138&lt;/TD&gt;&lt;TD&gt;Automatic&lt;/TD&gt;&lt;TD&gt;09-Apr-22&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CP138&lt;/TD&gt;&lt;TD&gt;Manual&lt;/TD&gt;&lt;TD&gt;09-Jun-22&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 20 Dec 2022 15:37:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-the-Sum-count-till-selected-date/m-p/2979457#M99855</guid>
      <dc:creator>Pranali_R</dc:creator>
      <dc:date>2022-12-20T15:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to Calculate the Sum/count till selected date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-the-Sum-count-till-selected-date/m-p/2984586#M100113</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="476762" data-lia-user-login="Pranali_R" class="lia-mention lia-mention-user"&gt;Pranali_R&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you need a 'Date' table linked with the main 'Table' then you can use a matrix visual, place 'Date'[Month-Year] in the columns and 'Table']Type] in the rows then place the following measure in the values&lt;/P&gt;
&lt;P&gt;Count =&lt;BR /&gt;VAR CurrentDate =&lt;BR /&gt;MAX ( 'Date'[Date] )&lt;BR /&gt;VAR CurrentNames =&lt;BR /&gt;CALCULATETABLE ( VALUES ( 'Table'[Name] ), ALL ( 'Date' ) )&lt;BR /&gt;RETURN&lt;BR /&gt;SUMX (&lt;BR /&gt;CurrentNames,&lt;BR /&gt;VAR MaxDate =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;MAX ( 'Table'[Value_Updated Date] ),&lt;BR /&gt;ALL ( 'Table'[Type] ),&lt;BR /&gt;ALL ( 'Date' )&lt;BR /&gt;)&lt;BR /&gt;VAR ThisDate =&lt;BR /&gt;CALCULATE ( MAX ( 'Table'[Value_Updated Date] ), ALL ( 'Date' ) )&lt;BR /&gt;RETURN&lt;BR /&gt;IF ( ThisDate &amp;lt;= CurrentDate &amp;amp;&amp;amp; ThisDate &amp;gt;= MaxDate, 1 )&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 14:58:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-Calculate-the-Sum-count-till-selected-date/m-p/2984586#M100113</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-12-22T14:58:14Z</dc:date>
    </item>
  </channel>
</rss>

