<?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: Aging in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1483135#M28343</link>
    <description>&lt;P&gt;Great&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="269265" data-lia-user-login="Andrewutter12" class="lia-mention lia-mention-user"&gt;Andrewutter12&lt;/a&gt;&amp;nbsp;- glad to be of assistance. As a CPA, I've done quite a few AP and AR aging reports.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Nov 2020 17:07:30 GMT</pubDate>
    <dc:creator>edhans</dc:creator>
    <dc:date>2020-11-09T17:07:30Z</dc:date>
    <item>
      <title>Aging</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1479902#M28214</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to create a Accounts Receivable table based on a table I already have within PowerBI. Within the table I have a journal column that shows the Sales Journal and Cash Receipt (invoice and payment on two different lines). I need to first set up a measure to deduct the receipt journal from the sales journal based on invoice number to determine if there is actually an outstanding receivable for that&amp;nbsp; client/invoice . Once this is determined, I need to then sort the outstanding receivables by the number of days it has been outstanding within standard buckets (e.g. 30, 60, 90, 120+). My end goal is to get a pie chart visual to show the amount of receivables within each bucket.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if you can help.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 19:00:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1479902#M28214</guid>
      <dc:creator>Andrewutter12</dc:creator>
      <dc:date>2020-11-06T19:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Aging</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1479995#M28218</link>
      <description>&lt;P&gt;Without sample data&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="269265" data-lia-user-login="Andrewutter12" class="lia-mention lia-mention-user"&gt;Andrewutter12&lt;/a&gt;&amp;nbsp;this is hard to do as I don't fully understand your scenario. However, I mocked something up. I turn this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Into this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;So my sample data has some invoices fully paid, partially paid, and not at all paid. I also assumed the due date was 30 days after the sales date. This is the M code to do it.&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCvZS0lEyNDO2MADS5vrGhvpGBkYgtomBgYFSrE60kjOyCkugNEyFLlwJxBALIADSFvpwM4B6kM2AK0DYomtshmKGJRCArUG4wwikIBYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Journal = _t, #"Invoice Number" = _t, #"Transaction Date" = _t, Amount = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Transaction Date", type date}, {"Amount", Currency.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Invoice Number"}, {{"Balance", each List.Sum([Amount]), type nullable number}, {"AllRows", each _, type table [Journal=nullable text, Invoice Number=nullable text, Transaction Date=nullable date, Amount=nullable number]}}),
    #"Added Date Due" = Table.AddColumn(#"Grouped Rows", "Date Due", each Date.AddDays(Table.SelectRows([AllRows], each [Journal] = "SJ")[Transaction Date]{0}, 30), type date),
    #"Added Days Past Due" = Table.AddColumn(#"Added Date Due", "Days Past Due", each Duration.Days(DateTime.Date(DateTime.LocalNow()) - [Date Due]), Int64.Type),
    #"Added Bucket" = Table.AddColumn(#"Added Days Past Due", "Bucket", each if [Days Past Due] &amp;lt; 31 then "Current"
else if [Days Past Due] &amp;lt; 61 then "31-60"
else if [Days Past Due] &amp;lt; 91 then "61-90" 
else "90+ days", type text),
    #"Filtered Rows" = Table.SelectRows(#"Added Bucket", each ([Balance] &amp;lt;&amp;gt; 0)),
    #"Expanded AllRows" = Table.ExpandTableColumn(#"Filtered Rows", "AllRows", {"Journal"}, {"Journal"})
in
    #"Expanded AllRows"&lt;/LI-CODE&gt;
&lt;P&gt;How to use M code provided in a blank query:&lt;BR /&gt;1) In Power Query, select New Source, then Blank Query&lt;BR /&gt;2) On the Home ribbon, select "Advanced Editor" button&lt;BR /&gt;3) Remove everything you see, then paste the M code I've given you in that box.&lt;BR /&gt;4) Press Done&lt;BR /&gt;5) &lt;A href="https://community.powerbi.com/t5/Community-Blog/Utilizing-M-Code-Samples-Given-as-Solutions-in-Power-Query/ba-p/1147514" target="_blank"&gt;See this article if you need help using this M code in your model.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need more help&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="269265" data-lia-user-login="Andrewutter12" class="lia-mention lia-mention-user"&gt;Andrewutter12&lt;/a&gt;&amp;nbsp;please give us some sample data and expected output that we can use. Screenshots are fine for expected output, but not for sample data.&lt;/P&gt;
&lt;P&gt;How to get good help fast. Help us help you.&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" rel="noopener" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" rel="noopener" target="_blank"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 21:03:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1479995#M28218</guid>
      <dc:creator>edhans</dc:creator>
      <dc:date>2020-11-06T21:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Aging</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1483130#M28342</link>
      <description>&lt;P&gt;Thank you for your help on this! This solution appeared to work!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 17:04:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1483130#M28342</guid>
      <dc:creator>Andrewutter12</dc:creator>
      <dc:date>2020-11-09T17:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Aging</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1483135#M28343</link>
      <description>&lt;P&gt;Great&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="269265" data-lia-user-login="Andrewutter12" class="lia-mention lia-mention-user"&gt;Andrewutter12&lt;/a&gt;&amp;nbsp;- glad to be of assistance. As a CPA, I've done quite a few AP and AR aging reports.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 17:07:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1483135#M28343</guid>
      <dc:creator>edhans</dc:creator>
      <dc:date>2020-11-09T17:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Aging</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1484225#M28371</link>
      <description>&lt;P&gt;I have done the bucking thing in the sql query view where I have craeted a sql view for bucket dimension and then have inorporated it into the model and then have a FK PK join between the fact tabke and this bucketing dim.&lt;/P&gt;&lt;P&gt;Or else you can add a table in here if you do not have view acess and then join the table in model.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 07:45:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Aging/m-p/1484225#M28371</guid>
      <dc:creator>kumar27</dc:creator>
      <dc:date>2020-11-10T07:45:49Z</dc:date>
    </item>
  </channel>
</rss>

