<?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 Assistance with Maturity Analysis: Analyzing Past Due Payments by Specific Date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-with-Maturity-Analysis-Analyzing-Past-Due-Payments-by/m-p/3395530#M157592</link>
    <description>&lt;P&gt;Hello Power BI community,&lt;/P&gt;&lt;P&gt;I'm working on a complex problem related to maturity analysis, specifically categorizing due payments by various age ranges (0-30 days, 31-60 days, over 60 days) as of a specific date. The goal is to retrospectively analyze the status of due payments as of a specific date, even if the payment has been made since. The goal is to see how the different categories evolve over time.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Challenges:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Analyzing Past Payments:&lt;/STRONG&gt; If an invoice was issued on 15th March and paid on 14th May, and I want to analyze data as of 31st March, the invoice should appear in the "0-30 days due" category, even though it was paid later.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Partial Payments:&lt;/STRONG&gt; Some customers may have paid partial amounts, which must be considered in the analysis.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;Previous Attempts:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Direct Categorization in Data Source:&lt;/STRONG&gt; Tried to create the due categories directly in the data source without the ability to retrospectively view the status on a specific date.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Calculated Column using DAX:&lt;/STRONG&gt; Used DAX functions like VAR, FILTER, MAXX, SUMX, but couldn't correctly classify the due status by the specific date, nor accommodate specific conditions like partial payments.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Utilizing Power Query:&lt;/STRONG&gt; Attempting to transform data before modeling in Power BI didn't yield desired results.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Separate Date Table Creation:&lt;/STRONG&gt; Made a separate date table for historical analysis, but it led to inconsistencies in the calculated amounts.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Considering Partial Payments:&lt;/STRONG&gt; Attempts to account for partial payments led to difficulties in the correct assignment of outstanding amounts.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Combination of Filters and Context Control:&lt;/STRONG&gt; Various combinations of filters, context control, and logical conditions didn't provide the expected accuracy and consistency.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The complexity of requirements and specific data structure have made previous attempts unsuccessful. The retrospective analysis of due status on a given date remains a unique challenge.&lt;/P&gt;&lt;P&gt;I would greatly appreciate any insights or guidance from the community to tackle this problem. Here's a glimpse of the data structure:&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 in advance for your assistance! If it is possible I could provide a pbix with sample data.&lt;BR /&gt;&lt;BR /&gt;The current classification which works for the current &lt;SPAN&gt;due category classification&lt;/SPAN&gt;&amp;nbsp;is done with the following calculated column:&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;DueCategory =&lt;/P&gt;&lt;P&gt;VAR InvoiceNumber = 'SalesLineItems'[InvoiceNumber]&lt;/P&gt;&lt;P&gt;VAR MaxDebitDate = MAXX(FILTER('SalesLineItems', 'SalesLineItems'[InvoiceNumber] = InvoiceNumber), 'SalesLineItems'[DebitDate])&lt;/P&gt;&lt;P&gt;VAR InvoiceCurrency = MAXX(FILTER('SalesLineItems', 'SalesLineItems'[InvoiceNumber] = InvoiceNumber &amp;amp;&amp;amp; NOT(ISBLANK('SalesLineItems'[PosAmount]))), 'SalesLineItems'[Currency])&lt;/P&gt;&lt;P&gt;VAR PosAmount = SUMX(FILTER('SalesLineItems', 'SalesLineItems'[InvoiceNumber] = InvoiceNumber &amp;amp;&amp;amp; 'SalesLineItems'[Currency] = InvoiceCurrency), 'SalesLineItems'[PosAmount])&lt;/P&gt;&lt;P&gt;VAR TotalPayment = SUMX(FILTER('SalesLineItems', 'SalesLineItems'[InvoiceNumber] = InvoiceNumber &amp;amp;&amp;amp; 'SalesLineItems'[PaymentCurrency] = InvoiceCurrency), 'SalesLineItems'[PaymentAmount])&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ISBLANK(TotalPayment) || ROUND(TotalPayment,1) &amp;lt; ROUND(PosAmount,1),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR DaysDue = TODAY() - MaxDebitDate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SWITCH(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE(),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DaysDue-30 &amp;lt;= 30, "0-30 days due",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DaysDue-30 &amp;lt;= 60, "31-60 days due",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "over 60 days due"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Already paid"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 23 Aug 2023 20:19:46 GMT</pubDate>
    <dc:creator>digicontrolling</dc:creator>
    <dc:date>2023-08-23T20:19:46Z</dc:date>
    <item>
      <title>Assistance with Maturity Analysis: Analyzing Past Due Payments by Specific Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-with-Maturity-Analysis-Analyzing-Past-Due-Payments-by/m-p/3395530#M157592</link>
      <description>&lt;P&gt;Hello Power BI community,&lt;/P&gt;&lt;P&gt;I'm working on a complex problem related to maturity analysis, specifically categorizing due payments by various age ranges (0-30 days, 31-60 days, over 60 days) as of a specific date. The goal is to retrospectively analyze the status of due payments as of a specific date, even if the payment has been made since. The goal is to see how the different categories evolve over time.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Challenges:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Analyzing Past Payments:&lt;/STRONG&gt; If an invoice was issued on 15th March and paid on 14th May, and I want to analyze data as of 31st March, the invoice should appear in the "0-30 days due" category, even though it was paid later.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Partial Payments:&lt;/STRONG&gt; Some customers may have paid partial amounts, which must be considered in the analysis.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;Previous Attempts:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Direct Categorization in Data Source:&lt;/STRONG&gt; Tried to create the due categories directly in the data source without the ability to retrospectively view the status on a specific date.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Calculated Column using DAX:&lt;/STRONG&gt; Used DAX functions like VAR, FILTER, MAXX, SUMX, but couldn't correctly classify the due status by the specific date, nor accommodate specific conditions like partial payments.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Utilizing Power Query:&lt;/STRONG&gt; Attempting to transform data before modeling in Power BI didn't yield desired results.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Separate Date Table Creation:&lt;/STRONG&gt; Made a separate date table for historical analysis, but it led to inconsistencies in the calculated amounts.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Considering Partial Payments:&lt;/STRONG&gt; Attempts to account for partial payments led to difficulties in the correct assignment of outstanding amounts.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Combination of Filters and Context Control:&lt;/STRONG&gt; Various combinations of filters, context control, and logical conditions didn't provide the expected accuracy and consistency.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The complexity of requirements and specific data structure have made previous attempts unsuccessful. The retrospective analysis of due status on a given date remains a unique challenge.&lt;/P&gt;&lt;P&gt;I would greatly appreciate any insights or guidance from the community to tackle this problem. Here's a glimpse of the data structure:&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 in advance for your assistance! If it is possible I could provide a pbix with sample data.&lt;BR /&gt;&lt;BR /&gt;The current classification which works for the current &lt;SPAN&gt;due category classification&lt;/SPAN&gt;&amp;nbsp;is done with the following calculated column:&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;DueCategory =&lt;/P&gt;&lt;P&gt;VAR InvoiceNumber = 'SalesLineItems'[InvoiceNumber]&lt;/P&gt;&lt;P&gt;VAR MaxDebitDate = MAXX(FILTER('SalesLineItems', 'SalesLineItems'[InvoiceNumber] = InvoiceNumber), 'SalesLineItems'[DebitDate])&lt;/P&gt;&lt;P&gt;VAR InvoiceCurrency = MAXX(FILTER('SalesLineItems', 'SalesLineItems'[InvoiceNumber] = InvoiceNumber &amp;amp;&amp;amp; NOT(ISBLANK('SalesLineItems'[PosAmount]))), 'SalesLineItems'[Currency])&lt;/P&gt;&lt;P&gt;VAR PosAmount = SUMX(FILTER('SalesLineItems', 'SalesLineItems'[InvoiceNumber] = InvoiceNumber &amp;amp;&amp;amp; 'SalesLineItems'[Currency] = InvoiceCurrency), 'SalesLineItems'[PosAmount])&lt;/P&gt;&lt;P&gt;VAR TotalPayment = SUMX(FILTER('SalesLineItems', 'SalesLineItems'[InvoiceNumber] = InvoiceNumber &amp;amp;&amp;amp; 'SalesLineItems'[PaymentCurrency] = InvoiceCurrency), 'SalesLineItems'[PaymentAmount])&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ISBLANK(TotalPayment) || ROUND(TotalPayment,1) &amp;lt; ROUND(PosAmount,1),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR DaysDue = TODAY() - MaxDebitDate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SWITCH(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRUE(),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DaysDue-30 &amp;lt;= 30, "0-30 days due",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DaysDue-30 &amp;lt;= 60, "31-60 days due",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "over 60 days due"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Already paid"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Aug 2023 20:19:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Assistance-with-Maturity-Analysis-Analyzing-Past-Due-Payments-by/m-p/3395530#M157592</guid>
      <dc:creator>digicontrolling</dc:creator>
      <dc:date>2023-08-23T20:19:46Z</dc:date>
    </item>
  </channel>
</rss>

