<?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 Finding date when cumulative total crosses dynamic target threshold in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-date-when-cumulative-total-crosses-dynamic-target/m-p/3827536#M149645</link>
    <description>&lt;P&gt;I'm trying to get a measure to return the date for each month when the cumulative revenue of that month exceeded 50%. So for example, if we made 100k in January, I would like to find the day when we crossed 50k that month.&lt;/P&gt;&lt;P&gt;I've already created the cumulative total per month like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_RevenueCumulated = TOTALMTD ( [_RevenueTotal], DateTable[FullDateAlternateKey] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And for the day I have the following measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_RevenueDate50% = 
VAR RevMonth = CALCULATE( [_RevenueTotal], ALLEXCEPT( DateTable, DateTable[Year], DateTable[Month Name] ) )
VAR RevCum = [_RevenueCumulated]
RETURN
    MINX(
        FILTER(
            VALUES(DateTable[FullDateAlternateKey]),
            RevCum &amp;gt;= 0.5 * RevMonth
        ),
        DateTable[FullDateAlternateKey]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This kind of gives me the right result if I put it in a matrix:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The first time we cross the 50% revenue is on the 24th of November, the problem is once I remove the day in the matrix it always goes to the first of the month (as seen in the total).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works if I try it with a fixed amount like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_RevenueDate50% = 
VAR RevCum = [_RevenueCumulated]
RETURN
    MINX(
        FILTER(
            VALUES(DateTable[FullDateAlternateKey]),
            RevCum &amp;gt;= 50000
        ),
        DateTable[FullDateAlternateKey]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it seems the problem is with the dynamically changing revenue for each month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 10 Apr 2024 13:10:39 GMT</pubDate>
    <dc:creator>jori</dc:creator>
    <dc:date>2024-04-10T13:10:39Z</dc:date>
    <item>
      <title>Finding date when cumulative total crosses dynamic target threshold</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-date-when-cumulative-total-crosses-dynamic-target/m-p/3827536#M149645</link>
      <description>&lt;P&gt;I'm trying to get a measure to return the date for each month when the cumulative revenue of that month exceeded 50%. So for example, if we made 100k in January, I would like to find the day when we crossed 50k that month.&lt;/P&gt;&lt;P&gt;I've already created the cumulative total per month like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_RevenueCumulated = TOTALMTD ( [_RevenueTotal], DateTable[FullDateAlternateKey] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And for the day I have the following measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_RevenueDate50% = 
VAR RevMonth = CALCULATE( [_RevenueTotal], ALLEXCEPT( DateTable, DateTable[Year], DateTable[Month Name] ) )
VAR RevCum = [_RevenueCumulated]
RETURN
    MINX(
        FILTER(
            VALUES(DateTable[FullDateAlternateKey]),
            RevCum &amp;gt;= 0.5 * RevMonth
        ),
        DateTable[FullDateAlternateKey]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This kind of gives me the right result if I put it in a matrix:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The first time we cross the 50% revenue is on the 24th of November, the problem is once I remove the day in the matrix it always goes to the first of the month (as seen in the total).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works if I try it with a fixed amount like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_RevenueDate50% = 
VAR RevCum = [_RevenueCumulated]
RETURN
    MINX(
        FILTER(
            VALUES(DateTable[FullDateAlternateKey]),
            RevCum &amp;gt;= 50000
        ),
        DateTable[FullDateAlternateKey]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it seems the problem is with the dynamically changing revenue for each month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2024 13:10:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-date-when-cumulative-total-crosses-dynamic-target/m-p/3827536#M149645</guid>
      <dc:creator>jori</dc:creator>
      <dc:date>2024-04-10T13:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Finding date when cumulative total crosses dynamic target threshold</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-date-when-cumulative-total-crosses-dynamic-target/m-p/3829932#M149742</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="465876" data-lia-user-login="jori" class="lia-mention lia-mention-user"&gt;jori&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This seems to be related to context, which is the possibility to perform dynamic analyses. Understanding the context is important for generating and troubleshooting formulas. More details can be found at the link: &lt;A href="https://support.microsoft.com/en-us/office/context-in-dax-formulas-2728fae0-8309-45b6-9d32-1d600440a7ad" target="_blank"&gt;Context in DAX Formulas - Microsoft Support&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this problem, you may be able to create a virtual intermediate table to perform calculations with the help of ADDCOLUMNS or SUMMARIZE functions. Something like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR CumulativeTable =

ADDCOLUMNS(

VALUES(DateTable[FullDateAlternateKey]),

"CumulativeRevenue", [_RevenueCumulated]

)&lt;/LI-CODE&gt;
&lt;P&gt;Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help we can better understand the problem and help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 07:48:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-date-when-cumulative-total-crosses-dynamic-target/m-p/3829932#M149742</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-11T07:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Finding date when cumulative total crosses dynamic target threshold</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-date-when-cumulative-total-crosses-dynamic-target/m-p/3830217#M149755</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;this actually helped.&lt;/P&gt;&lt;P&gt;My working solution is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;_RevenueDate50% = 
VAR RevMonth = CALCULATE( [_RevenueTotal], ALLEXCEPT( DateTable, DateTable[Year], DateTable[Month Name] ) )
VAR CumulativeTable =
    ADDCOLUMNS(
        VALUES(DateTable[FullDateAlternateKey]),
        "CumulativeRevenue", [_RevenueCumulated],
        "RevMonth", RevMonth
    )
RETURN
    MINX(
        FILTER(
            CumulativeTable,
            [CumulativeRevenue] &amp;gt;= 0.5 * [RevMonth]
        ),
        DateTable[FullDateAlternateKey]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 09:15:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-date-when-cumulative-total-crosses-dynamic-target/m-p/3830217#M149755</guid>
      <dc:creator>jori</dc:creator>
      <dc:date>2024-04-11T09:15:00Z</dc:date>
    </item>
  </channel>
</rss>

