<?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 create a running total with baseline and filters in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3703185#M144026</link>
    <description>&lt;P&gt;To create a running total with baseline and filters in Power BI using DAX, you can follow these steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create a Date Table&lt;/STRONG&gt;: Ensure you have a date table that covers the period of your forecast. This table should have a column for dates (Date) and can include additional columns like year, month, day, etc.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Define your Data Model&lt;/STRONG&gt;: Ensure your dataset includes a table with the following columns: Date, Status, and Stock Change. The Stock Change column indicates the change in stock for each status on a specific date.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create Calculated Columns&lt;/STRONG&gt;: You need to calculate the net change in stock for each status based on the Stock Change column. For example:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NetChange =&lt;BR /&gt;VAR StatusChange = IF('Table'[Status] = "Current", 0, IF('Table'[Status] = "Due for Replacement", 'Table'[Stock Change], -'Table'[Stock Change]))&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(SUM('Table'[NetChange]), FILTER('Table', 'Table'[Date] &amp;lt;= EARLIER('Table'[Date]))) + StatusChange&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;This DAX expression calculates the net change in stock by summing up the changes in stock for each status up to the current date.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create Measures&lt;/STRONG&gt;: You can create measures to calculate the running total for each status. For example:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;RunningTotal_DueForReplacement =&lt;BR /&gt;CALCULATE(SUM('Table'[NetChange]), FILTER(ALLSELECTED('Table'), 'Table'[Status] = "Due for Replacement"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;This measure calculates the running total of stock for the "Due for Replacement" status.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Visualize on a Graph&lt;/STRONG&gt;: You can use a line chart or an area chart to visualize the running total of each status over time. Place the date on the x-axis and the running total measure on the y-axis. You can add filters to the visualizations to focus on specific statuses if needed.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;By following these steps, you should be able to create a running total with baseline and filters in Power BI using DAX. Make sure to adjust the column and table names in the DAX expressions according to your actual dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Feb 2024 06:13:21 GMT</pubDate>
    <dc:creator>123abc</dc:creator>
    <dc:date>2024-02-16T06:13:21Z</dc:date>
    <item>
      <title>How to create a running total with baseline and filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3702992#M144020</link>
      <description>&lt;P&gt;The main goal of this is to create a forcast of data given an amount of stock and how that stock will change.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Say I have an orignal amount, I want to subtract based on one status and then add based on another over time.&lt;BR /&gt;If we have three status &lt;STRONG&gt;"Current"&lt;/STRONG&gt;,&lt;STRONG&gt; "Due for Replacement"&lt;/STRONG&gt; and &lt;STRONG&gt;"Need to be Repaced"&lt;/STRONG&gt;&lt;BR /&gt;And we orignally have 100 &lt;STRONG&gt;"Due for Replacement"&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;If we start on 01/01/2024&lt;BR /&gt;Then 5 stock changes from&amp;nbsp;&lt;STRONG&gt;"Current"&lt;/STRONG&gt; to &lt;STRONG&gt;"Due for Replacement"&lt;/STRONG&gt; on 05/01/2024&lt;BR /&gt;On the 05/01/2024 the total &lt;STRONG&gt;"Due for Replacement"&lt;/STRONG&gt; will equal 105&lt;BR /&gt;This would then stay at this value until 15/05/2024 where 10 stock moves from &lt;STRONG&gt;"Due for Replacement"&lt;/STRONG&gt; to&lt;STRONG&gt; "Need to be Replaced"&lt;/STRONG&gt;&lt;BR /&gt;Meaning the total on the 15/01/2024 would be 95&lt;BR /&gt;Say then a few days later on 25/01/2024 10 stock changes from&amp;nbsp;&lt;STRONG&gt;"Current"&lt;/STRONG&gt; to &lt;STRONG&gt;"Due for Replacement" &lt;/STRONG&gt;and 5 stock moves from &lt;STRONG&gt;"Due for Replacement"&lt;/STRONG&gt; to&lt;STRONG&gt; "Need to be Replaced"&lt;BR /&gt;&lt;/STRONG&gt;After all of this the value for &lt;STRONG&gt;"Due for Replacement"&amp;nbsp;&lt;/STRONG&gt;should once again equal 100.&lt;BR /&gt;&lt;BR /&gt;I know this is more of a complicated forcast graph but Ive been struggling a little to get my head around how I could do this and show it on a graph.&lt;BR /&gt;&lt;BR /&gt;Any help would be appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 04:07:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3702992#M144020</guid>
      <dc:creator>SamuelBurt</dc:creator>
      <dc:date>2024-02-16T04:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a running total with baseline and filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3703185#M144026</link>
      <description>&lt;P&gt;To create a running total with baseline and filters in Power BI using DAX, you can follow these steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create a Date Table&lt;/STRONG&gt;: Ensure you have a date table that covers the period of your forecast. This table should have a column for dates (Date) and can include additional columns like year, month, day, etc.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Define your Data Model&lt;/STRONG&gt;: Ensure your dataset includes a table with the following columns: Date, Status, and Stock Change. The Stock Change column indicates the change in stock for each status on a specific date.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create Calculated Columns&lt;/STRONG&gt;: You need to calculate the net change in stock for each status based on the Stock Change column. For example:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NetChange =&lt;BR /&gt;VAR StatusChange = IF('Table'[Status] = "Current", 0, IF('Table'[Status] = "Due for Replacement", 'Table'[Stock Change], -'Table'[Stock Change]))&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(SUM('Table'[NetChange]), FILTER('Table', 'Table'[Date] &amp;lt;= EARLIER('Table'[Date]))) + StatusChange&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;This DAX expression calculates the net change in stock by summing up the changes in stock for each status up to the current date.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create Measures&lt;/STRONG&gt;: You can create measures to calculate the running total for each status. For example:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;RunningTotal_DueForReplacement =&lt;BR /&gt;CALCULATE(SUM('Table'[NetChange]), FILTER(ALLSELECTED('Table'), 'Table'[Status] = "Due for Replacement"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;This measure calculates the running total of stock for the "Due for Replacement" status.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Visualize on a Graph&lt;/STRONG&gt;: You can use a line chart or an area chart to visualize the running total of each status over time. Place the date on the x-axis and the running total measure on the y-axis. You can add filters to the visualizations to focus on specific statuses if needed.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;By following these steps, you should be able to create a running total with baseline and filters in Power BI using DAX. Make sure to adjust the column and table names in the DAX expressions according to your actual dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 06:13:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3703185#M144026</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-02-16T06:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a running total with baseline and filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3706347#M144187</link>
      <description>&lt;P&gt;One step im stuck on is creating the net change, given the calculation you have given it creates a circular dependancy specifically &lt;STRONG&gt;SUM('Table'[NetChange]) &lt;/STRONG&gt;in the &lt;STRONG&gt;NetChange&lt;/STRONG&gt; column.&lt;BR /&gt;&lt;BR /&gt;Is this what is expected if so how do I get around that?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2024 21:46:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3706347#M144187</guid>
      <dc:creator>SamuelBurt</dc:creator>
      <dc:date>2024-02-18T21:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a running total with baseline and filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3712218#M144437</link>
      <description>&lt;P&gt;Whilst not exactly what I was looking for this did help a bunch in calculating what I needed, thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 20:23:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3712218#M144437</guid>
      <dc:creator>SamuelBurt</dc:creator>
      <dc:date>2024-02-20T20:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a running total with baseline and filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3713052#M144485</link>
      <description>&lt;P&gt;If you're encountering a circular dependency issue with the calculation of the net change, you may need to approach it differently. Circular dependencies occur when a formula refers to its own cell either directly or indirectly.&lt;/P&gt;&lt;P&gt;To calculate the net change, you can try a different approach. Instead of directly referencing the running total measure within the same calculation, you can calculate the net change separately. Here's how you can modify your DAX measures:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Running Total Measure:&lt;/STRONG&gt; Keep the running total measure as previously defined.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Net Change Measure:&lt;/STRONG&gt; Create a new measure to calculate the net change for each status. You can use SUMX and FILTER to iterate through the table and calculate the net change based on the status.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's an example of how you can define the net change measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Net Change =&lt;BR /&gt;VAR CurrentDate = MAX('YourDateTable'[Date])&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('YourStockTable'[Amount]),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('YourDateTable'),&lt;BR /&gt;'YourDateTable'[Date] = CurrentDate&lt;BR /&gt;),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('YourStatusTable'),&lt;BR /&gt;'YourStatusTable'[Status] = "Due for Replacement"&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;+&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('YourStockTable'[Amount]),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('YourDateTable'),&lt;BR /&gt;'YourDateTable'[Date] = CurrentDate&lt;BR /&gt;),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('YourStatusTable'),&lt;BR /&gt;'YourStatusTable'[Status] = "Need to be Replaced"&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;-&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('YourStockTable'[Amount]),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('YourDateTable'),&lt;BR /&gt;'YourDateTable'[Date] = CurrentDate&lt;BR /&gt;),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('YourStatusTable'),&lt;BR /&gt;'YourStatusTable'[Status] = "Current"&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This measure calculates the net change for each status category on the current date. It sums the amounts of stock for each status and subtracts the amount of stock in the "Current" status.&lt;/P&gt;&lt;P&gt;By calculating the net change separately, you avoid the circular dependency issue. You can then use this net change measure in your calculations or visualizations as needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 05:01:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-a-running-total-with-baseline-and-filters/m-p/3713052#M144485</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-02-21T05:01:15Z</dc:date>
    </item>
  </channel>
</rss>

