<?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: I need to create a formula, but I don't know how in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-formula-but-I-don-t-know-how/m-p/4407987#M175026</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="930510" data-lia-user-login="Guilherme587171" class="lia-mention lia-mention-user"&gt;Guilherme587171&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be nice to share an example and give the expected output.&lt;BR /&gt;I'm assuming you have a table like this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I created a calendar table and created relationships:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then please create these measures:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ShowValueForDates = 
VAR __last_date_with_data = CALCULATE(MAX('Table'[Due Date]),REMOVEFILTERS())
VAR __first_date_visible = MIN('Date'[Date])
VAR __result = __first_date_visible &amp;lt;= MIN(__last_date_with_data, TODAY())
RETURN
    __result&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;OverDue Count = 
VAR __today =
    TODAY ()
VAR __overdue_count =
    IF (
        [ShowValueForDates],
        CALCULATE (
            COUNTROWS ( 'Table' ),
            (
                'Table'[Date completed] = BLANK ()
                    &amp;amp;&amp;amp; 'Table'[Due Date] &amp;lt;= __today
            )
                || ( 'Table'[Date completed] &amp;gt; 'Table'[Due Date] )
        )
    )
RETURN
    __overdue_count&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Count ALL = COUNTROWS('Table')&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Percentage Overdue = DIVIDE([OverDue Count],[Count ALL])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Cumulative Percentage Overdue = 
VAR __cumulative_overdue_count = IF([ShowValueForDates], CALCULATE([OverDue Count],FILTER(ALL('Table'),'Table'[Due Date]&amp;lt;=MAX('Date'[Date]))))
VAR __cumulative_count_all = IF([ShowValueForDates], CALCULATE([Count ALL],FILTER(ALL('Table'),'Table'[Due Date]&amp;lt;=MAX('Date'[Date]))))
RETURN
    DIVIDE(__cumulative_overdue_count,__cumulative_count_all)&lt;/LI-CODE&gt;
&lt;P&gt;[OverDue Amount] Similar to the above.&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Best Regards,&lt;BR /&gt;Gao&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Community Support Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If there is any post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3" color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT size="3"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener nofollow noreferrer"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener nofollow noreferrer"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Feb 2025 02:47:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2025-02-13T02:47:05Z</dc:date>
    <item>
      <title>I need to create a formula, but I don't know how</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-formula-but-I-don-t-know-how/m-p/4407622#M175009</link>
      <description>&lt;P&gt;"Let's go, I have the inclusion date of the amount and the due date in the same table, and I need to include the included amount, the due amount, and a division that returns the percentage overdue in the same table. But in all the ways I've tried, it results in some conflict in the table and does not return the correct data...&lt;/P&gt;&lt;P&gt;Does anyone have any suggestions on how to solve this?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 19:50:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-formula-but-I-don-t-know-how/m-p/4407622#M175009</guid>
      <dc:creator>Guilherme587171</dc:creator>
      <dc:date>2025-02-12T19:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: I need to create a formula, but I don't know how</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-formula-but-I-don-t-know-how/m-p/4407987#M175026</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="930510" data-lia-user-login="Guilherme587171" class="lia-mention lia-mention-user"&gt;Guilherme587171&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be nice to share an example and give the expected output.&lt;BR /&gt;I'm assuming you have a table like this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I created a calendar table and created relationships:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then please create these measures:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ShowValueForDates = 
VAR __last_date_with_data = CALCULATE(MAX('Table'[Due Date]),REMOVEFILTERS())
VAR __first_date_visible = MIN('Date'[Date])
VAR __result = __first_date_visible &amp;lt;= MIN(__last_date_with_data, TODAY())
RETURN
    __result&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;OverDue Count = 
VAR __today =
    TODAY ()
VAR __overdue_count =
    IF (
        [ShowValueForDates],
        CALCULATE (
            COUNTROWS ( 'Table' ),
            (
                'Table'[Date completed] = BLANK ()
                    &amp;amp;&amp;amp; 'Table'[Due Date] &amp;lt;= __today
            )
                || ( 'Table'[Date completed] &amp;gt; 'Table'[Due Date] )
        )
    )
RETURN
    __overdue_count&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Count ALL = COUNTROWS('Table')&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Percentage Overdue = DIVIDE([OverDue Count],[Count ALL])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Cumulative Percentage Overdue = 
VAR __cumulative_overdue_count = IF([ShowValueForDates], CALCULATE([OverDue Count],FILTER(ALL('Table'),'Table'[Due Date]&amp;lt;=MAX('Date'[Date]))))
VAR __cumulative_count_all = IF([ShowValueForDates], CALCULATE([Count ALL],FILTER(ALL('Table'),'Table'[Due Date]&amp;lt;=MAX('Date'[Date]))))
RETURN
    DIVIDE(__cumulative_overdue_count,__cumulative_count_all)&lt;/LI-CODE&gt;
&lt;P&gt;[OverDue Amount] Similar to the above.&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Best Regards,&lt;BR /&gt;Gao&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Community Support Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If there is any post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3" color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT size="3"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener nofollow noreferrer"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener nofollow noreferrer"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2025 02:47:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-formula-but-I-don-t-know-how/m-p/4407987#M175026</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-02-13T02:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: I need to create a formula, but I don't know how</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-formula-but-I-don-t-know-how/m-p/4408220#M175044</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="930510" data-lia-user-login="Guilherme587171" class="lia-mention lia-mention-user"&gt;Guilherme587171&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To calculate the &lt;STRONG data-start="17" data-end="72"&gt;included amount, due amount, and overdue percentage&lt;/STRONG&gt; in the same table without conflicts, you need to create &lt;STRONG data-start="129" data-end="154"&gt;separate DAX measures&lt;/STRONG&gt; for each value. The &lt;STRONG data-start="175" data-end="194"&gt;included amount&lt;/STRONG&gt; should sum values based on the &lt;STRONG data-start="226" data-end="244"&gt;inclusion date&lt;/STRONG&gt;, while the &lt;STRONG data-start="256" data-end="270"&gt;due amount&lt;/STRONG&gt; should sum values based on the &lt;STRONG data-start="302" data-end="314"&gt;due date&lt;/STRONG&gt;. The &lt;STRONG data-start="320" data-end="342"&gt;overdue percentage&lt;/STRONG&gt; is calculated as the ratio of the overdue amount to the total due amount. A key challenge is ensuring that date filters do not interfere with calculations, which can be managed using the &lt;STRONG data-start="530" data-end="545"&gt;CALCULATE()&lt;/STRONG&gt; function with &lt;STRONG data-start="560" data-end="579"&gt;REMOVEFILTERS()&lt;/STRONG&gt; or &lt;STRONG data-start="583" data-end="592"&gt;ALL()&lt;/STRONG&gt; on the appropriate date column. Additionally, ensure that relationships between tables (if any) do not filter out relevant data unexpectedly. If issues persist, validating the data model structure and testing individual measures separately can help pinpoint errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2025 05:37:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-formula-but-I-don-t-know-how/m-p/4408220#M175044</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2025-02-13T05:37:54Z</dc:date>
    </item>
  </channel>
</rss>

