<?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: power bi dax - expiry date problem calculate cumulative total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3303375#M123305</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="578509" data-lia-user-login="streli" class="lia-mention lia-mention-user"&gt;streli&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You can try to use the following measure formula to get the cumulative total based on current date and expiry date:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Cumulative Volume =
CALCULATE (
    SUM ( Table1[volume] ),
    FILTER (
        ALLSELECTED ( Table1 ),
        Table1[datekey] &amp;lt;= MAX ( Table1[datekey] )
            &amp;amp;&amp;amp; Table1[datekey] &amp;lt;= Table1[expired date]
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jun 2023 01:43:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-06-27T01:43:43Z</dc:date>
    <item>
      <title>power bi dax - expiry date problem calculate cumulative total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3295543#M122777</link>
      <description>&lt;P&gt;hello everyone&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to calculate a cumulative amount using a dax measure so that this calculation only takes into account the volume associated with the expiry date until the expiry date, after which it...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so if the expiry date is today and I see 5 units here, then tomorrow already ignore this for the cumulative, but on the line chart for yesterday's date take note&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for June 7 I would like to see 26, for June 8 I would like to see 67, but for June 9 I would like to see 71 (and not 91...), because June 8 is the earlier (expired) date compared to June 9 and we don't need the 10-10 units we see on June 7 and June 8.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I would like a volume value to be included in the aggregate amount only as long as its expiry date is not earlier than dataday,&amp;nbsp;so I would like to see 71 for 9 June and 92 for 10 June&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;thank you very mutch&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 14:30:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3295543#M122777</guid>
      <dc:creator>streli</dc:creator>
      <dc:date>2023-06-21T14:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: power bi dax - expiry date problem calculate cumulative total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3297755#M122906</link>
      <description>&lt;P&gt;Can anyone help me?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 12:18:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3297755#M122906</guid>
      <dc:creator>streli</dc:creator>
      <dc:date>2023-06-22T12:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: power bi dax - expiry date problem calculate cumulative total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3303375#M123305</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="578509" data-lia-user-login="streli" class="lia-mention lia-mention-user"&gt;streli&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You can try to use the following measure formula to get the cumulative total based on current date and expiry date:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Cumulative Volume =
CALCULATE (
    SUM ( Table1[volume] ),
    FILTER (
        ALLSELECTED ( Table1 ),
        Table1[datekey] &amp;lt;= MAX ( Table1[datekey] )
            &amp;amp;&amp;amp; Table1[datekey] &amp;lt;= Table1[expired date]
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 01:43:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3303375#M123305</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-27T01:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: power bi dax - expiry date problem calculate cumulative total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3304314#M123373</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your reply, I tried, unfortunately it did not bring the expected result.&amp;nbsp;It should be 71 for 9 June and 92 for 10 June...&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 12:53:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3304314#M123373</guid>
      <dc:creator>streli</dc:creator>
      <dc:date>2023-06-27T12:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: power bi dax - expiry date problem calculate cumulative total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3305616#M123454</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="578509" data-lia-user-login="streli" class="lia-mention lia-mention-user"&gt;streli&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;After I double check on my formula, I find it seems only check the current records expired date values that may cause the rolling calculation on previous records.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;For that scenario, I modify the formula to add a condition to check the max expired date of previous date keys , you can try it if helps:&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Cumulative Volume =
VAR currDate =
    MAX ( Table1[datekey] )
VAR prevExpired =
    CALCULATE (
        MAX ( Table1[datekey] ),
        FILTER ( ALLSELECTED ( Table1 ), [datekey] &amp;lt; currDate )
    )
RETURN
    CALCULATE (
        SUM ( Table1[volume] ),
        FILTER (
            ALLSELECTED ( Table1 ),
            Table1[datekey] &amp;lt;= currDate
                &amp;amp;&amp;amp; AND ( Table1[datekey] &amp;lt;= Table1[expired date], Table1[datekey] &amp;gt; prevExpired )
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 06:29:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3305616#M123454</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-28T06:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: power bi dax - expiry date problem calculate cumulative total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3306889#M123520</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Xiaoxin Sheng,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I tried, unfortunately it did not work, but thank you very much for your reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 20:22:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/power-bi-dax-expiry-date-problem-calculate-cumulative-total/m-p/3306889#M123520</guid>
      <dc:creator>streli</dc:creator>
      <dc:date>2023-06-28T20:22:29Z</dc:date>
    </item>
  </channel>
</rss>

