<?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 Order By doesn't work in the right way and how to add row numbers per group in Qlik View? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Order-By-doesn-t-work-in-the-right-way-and-how-to-add-row/m-p/1933905#M1219085</link>
    <description>&lt;P&gt;I have a dataset with a format (notice the Q is actually month here, the column name is wrong)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="g1.PNG" style="width: 269px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80007iE301C4A87D764CE1/image-size/large?v=v2&amp;amp;px=999" role="button" title="g1.PNG" alt="g1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;that I want to group and sort so that the result will look like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="q2.PNG" style="width: 412px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80008i29A3D1364A5738EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="q2.PNG" alt="q2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have tried this so far&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Data:
LOAD
"Year",
Q,
"Order",
Price
FROM [path]
(ooxml, embedded labels, table is Sheet1);

data2:

Load
"Year",
Q,
"Order",
Sum(Price) as sum_price
Resident Data
Group By "Year", Q, "Order"
Order By "Year", Q, "Order";&lt;/LI-CODE&gt;
&lt;P&gt;However, this is what I get&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="q3.PNG" style="width: 329px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80009iE71EFEB0D09B64FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="q3.PNG" alt="q3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I also tried to sort with just order and it doesn't work. I would also like to add row numbers as shown in the desired result table, which is based on the year, month, and order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2022 13:51:11 GMT</pubDate>
    <dc:creator>ihuynhi</dc:creator>
    <dc:date>2022-11-03T13:51:11Z</dc:date>
    <item>
      <title>Order By doesn't work in the right way and how to add row numbers per group in Qlik View?</title>
      <link>https://community.qlik.com/t5/QlikView/Order-By-doesn-t-work-in-the-right-way-and-how-to-add-row/m-p/1933905#M1219085</link>
      <description>&lt;P&gt;I have a dataset with a format (notice the Q is actually month here, the column name is wrong)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="g1.PNG" style="width: 269px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80007iE301C4A87D764CE1/image-size/large?v=v2&amp;amp;px=999" role="button" title="g1.PNG" alt="g1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;that I want to group and sort so that the result will look like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="q2.PNG" style="width: 412px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80008i29A3D1364A5738EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="q2.PNG" alt="q2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have tried this so far&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Data:
LOAD
"Year",
Q,
"Order",
Price
FROM [path]
(ooxml, embedded labels, table is Sheet1);

data2:

Load
"Year",
Q,
"Order",
Sum(Price) as sum_price
Resident Data
Group By "Year", Q, "Order"
Order By "Year", Q, "Order";&lt;/LI-CODE&gt;
&lt;P&gt;However, this is what I get&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="q3.PNG" style="width: 329px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80009iE71EFEB0D09B64FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="q3.PNG" alt="q3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I also tried to sort with just order and it doesn't work. I would also like to add row numbers as shown in the desired result table, which is based on the year, month, and order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 13:51:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-By-doesn-t-work-in-the-right-way-and-how-to-add-row/m-p/1933905#M1219085</guid>
      <dc:creator>ihuynhi</dc:creator>
      <dc:date>2022-11-03T13:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Order By doesn't work in the right way and how to add row numbers per group?</title>
      <link>https://community.qlik.com/t5/QlikView/Order-By-doesn-t-work-in-the-right-way-and-how-to-add-row/m-p/1933929#M1219086</link>
      <description>&lt;P&gt;If you want to have the result sorted by Order, Year and Q you need to actually code it like this.&lt;/P&gt;
&lt;P&gt;One example including the row number as well:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;data2:
Load Year,
     Q,
     Order,
     Sum(Price) as sum_price,
     AutoNumber(Q, Year&amp;amp;Order) as row_num
Resident Data
Group By Year, Q, Order
Order By Order, Year, Q;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hope this helps&lt;/P&gt;
&lt;P&gt;Marco&lt;/P&gt;</description>
      <pubDate>Sat, 21 May 2022 19:58:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-By-doesn-t-work-in-the-right-way-and-how-to-add-row/m-p/1933929#M1219086</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2022-05-21T19:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Order By doesn't work in the right way and how to add row numbers per group?</title>
      <link>https://community.qlik.com/t5/QlikView/Order-By-doesn-t-work-in-the-right-way-and-how-to-add-row/m-p/1934112#M1219096</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you for the answer, it worked! However, the AutoNumber is incredibly slow, is there any other way to add the row numbers?&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 08:30:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-By-doesn-t-work-in-the-right-way-and-how-to-add-row/m-p/1934112#M1219096</guid>
      <dc:creator>ihuynhi</dc:creator>
      <dc:date>2022-05-23T08:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Order By doesn't work in the right way and how to add row numbers per group?</title>
      <link>https://community.qlik.com/t5/QlikView/Order-By-doesn-t-work-in-the-right-way-and-how-to-add-row/m-p/1934463#M1219105</link>
      <description>&lt;P&gt;another version without AutoNumber():&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;data2:
LOAD *,
     If(Year&amp;amp;Order=Previous(Year&amp;amp;Order),Peek(row_num)+1,1) as row_num;
LOAD Year,
     Q,
     Order,
     Sum(Price) as sum_price
Resident Data
Group By Year, Q, Order
Order By Order, Year, Q;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 20:17:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-By-doesn-t-work-in-the-right-way-and-how-to-add-row/m-p/1934463#M1219105</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2022-05-23T20:17:05Z</dc:date>
    </item>
  </channel>
</rss>

