<?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 Cumulative Frequency is not in ascending order in Postgres in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Cumulative-Frequency-is-not-in-ascending-order-in-Postgres/m-p/717590#M14630</link>
    <description>&lt;P&gt;I have made a CTE that shows the orderdate sum of the ordered quantity, and its respective cumulative frequency. I have to keep this line "JOIN cte c2 ON c1.orderdate&amp;lt;=c2.orderdate" in this form only and get the correct results. Please tell me what changes are to be made in the code to get the correct result. The code is done in Postgres. Below is the output which I want.&lt;/P&gt;&lt;P&gt;CODE&lt;/P&gt;&lt;P&gt;NOTE: No changes have to be made in this line "JOIN cte c2 ON c1.orderdate&amp;lt;=c2.orderdate"&lt;/P&gt;&lt;P&gt;WITH cte&lt;BR /&gt;AS(&lt;BR /&gt;SELECT o.orderdate, SUM(od.quantity) AS "totalsum" FROM orders o&lt;BR /&gt;JOIN orderdetails od ON o.orderid=od.orderid&lt;BR /&gt;GROUP BY o.orderdate&lt;BR /&gt;)&lt;BR /&gt;SELECT c1.orderdate, c1.totalsum, SUM(c2.totalsum) FROM cte c1&lt;BR /&gt;JOIN cte c2 ON c1.orderdate&amp;lt;=c2.orderdate&lt;BR /&gt;GROUP BY c1.orderdate, c1.totalsum&lt;BR /&gt;ORDER BY c1.orderdate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="karankhayani97_0-1612797527554.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54456i2EDB5AE511E37D7A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="karankhayani97_0-1612797527554.png" alt="karankhayani97_0-1612797527554.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Feb 2021 15:18:38 GMT</pubDate>
    <dc:creator>karankhayani97</dc:creator>
    <dc:date>2021-02-08T15:18:38Z</dc:date>
    <item>
      <title>Cumulative Frequency is not in ascending order in Postgres</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Cumulative-Frequency-is-not-in-ascending-order-in-Postgres/m-p/717590#M14630</link>
      <description>&lt;P&gt;I have made a CTE that shows the orderdate sum of the ordered quantity, and its respective cumulative frequency. I have to keep this line "JOIN cte c2 ON c1.orderdate&amp;lt;=c2.orderdate" in this form only and get the correct results. Please tell me what changes are to be made in the code to get the correct result. The code is done in Postgres. Below is the output which I want.&lt;/P&gt;&lt;P&gt;CODE&lt;/P&gt;&lt;P&gt;NOTE: No changes have to be made in this line "JOIN cte c2 ON c1.orderdate&amp;lt;=c2.orderdate"&lt;/P&gt;&lt;P&gt;WITH cte&lt;BR /&gt;AS(&lt;BR /&gt;SELECT o.orderdate, SUM(od.quantity) AS "totalsum" FROM orders o&lt;BR /&gt;JOIN orderdetails od ON o.orderid=od.orderid&lt;BR /&gt;GROUP BY o.orderdate&lt;BR /&gt;)&lt;BR /&gt;SELECT c1.orderdate, c1.totalsum, SUM(c2.totalsum) FROM cte c1&lt;BR /&gt;JOIN cte c2 ON c1.orderdate&amp;lt;=c2.orderdate&lt;BR /&gt;GROUP BY c1.orderdate, c1.totalsum&lt;BR /&gt;ORDER BY c1.orderdate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="karankhayani97_0-1612797527554.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54456i2EDB5AE511E37D7A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="karankhayani97_0-1612797527554.png" alt="karankhayani97_0-1612797527554.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 15:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Cumulative-Frequency-is-not-in-ascending-order-in-Postgres/m-p/717590#M14630</guid>
      <dc:creator>karankhayani97</dc:creator>
      <dc:date>2021-02-08T15:18:38Z</dc:date>
    </item>
  </channel>
</rss>

