<?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 Help AGGR() - FirstSortedValue() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136026#M20368</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hola tengo un problema que no puedo resolver y quería solicitar su ayuda. Tengo dos tablas llamadas Producto y Ventas, adjunto imagen:&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;Hi, I have a problem that I can not solve and I wanted to request your help. I have two tables called Product and Sales, attached image:)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/209150_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Debo generar una vista en una Tabla Pivotante o Tabla Simple que debe cumplir los sgtes. requerimientos:&lt;/P&gt;&lt;P&gt;1° Columna debe considerar todos los 'Grupos'.&lt;/P&gt;&lt;P&gt;2° Columna debe considerar solamente un registro del campo 'Nivel_1' por campo Grupo, que corresponde al 'Nivel_1' que tiene mayor venta.&lt;/P&gt;&lt;P&gt;3° Columna debe considerar solamente un registro del campo 'Nivel_2', que corresponde al 'Nivel_2' que tiene mayor venta y que corresponda al 'Nivel_1' seleccionado en la columna 2.&lt;/P&gt;&lt;P&gt;4° Columna debe considerar solamente un registro del campo 'Nivel_3', que corresponde al 'Nivel_3' que tiene mayor venta y que corresponda al 'Nivel_1' seleccionado en la columna 2 y al 'Nivel_2' seleccionado en la columna 3.&lt;/P&gt;&lt;P&gt;5° Columna debe considerar MontoVenta/Cantidad para los registros mostrados con anterioridad.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;I must generate a view in a Pivoting Table or Simple Table that must meet the following requirements:&lt;BR /&gt;1st Column should consider all the 'Groups'.&lt;BR /&gt;2nd Column should consider only a record of the 'Level_1' field &lt;SPAN lang="en"&gt;per Group field&lt;/SPAN&gt;, which corresponds to the 'Level_1' that has the highest sales.&lt;BR /&gt;3 ° Column should consider only one record of the field 'Level_2', which corresponds to 'Level_2' that has the highest sales and that corresponds to 'Level_1' selected in column 2.&lt;BR /&gt;4th Column should consider only a record of the field 'Level_3', which corresponds to 'Level_3' that has the highest sales and that corresponds to 'Level_1' selected in column 2 and to 'Level_2' selected in column 3.&lt;BR /&gt;5th Column must consider MontoVenta / Amount for the records shown previously.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dejo un ejemplo de los datos:&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;I leave an example of the data:)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/209151_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;El resultado esperado:&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;The expected result:)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/209152_pastedImage_5.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usé la sgte. expresión pero solamente me resulta en 'Nivel_1', por otro lado no se donde incluir MontoVenta/Cantidad:&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;I used this expression but it only results in 'Level_1', on the other hand I do not know where to include MontoVenta/Cantidad)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(Nivel_1, -Aggr(Sum ({&amp;lt;Año = {"$(MaxAño)"}&amp;gt;}MontoVenta), Nivel_1, Grupo))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Muchas gracias de antemano disculpen la traducción.&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;Many thanks in advance, sorry for the translation, Google Translate)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jul 2018 18:33:18 GMT</pubDate>
    <dc:creator>PEyzaguirre</dc:creator>
    <dc:date>2018-07-27T18:33:18Z</dc:date>
    <item>
      <title>Help AGGR() - FirstSortedValue()</title>
      <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136026#M20368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hola tengo un problema que no puedo resolver y quería solicitar su ayuda. Tengo dos tablas llamadas Producto y Ventas, adjunto imagen:&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;Hi, I have a problem that I can not solve and I wanted to request your help. I have two tables called Product and Sales, attached image:)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/209150_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Debo generar una vista en una Tabla Pivotante o Tabla Simple que debe cumplir los sgtes. requerimientos:&lt;/P&gt;&lt;P&gt;1° Columna debe considerar todos los 'Grupos'.&lt;/P&gt;&lt;P&gt;2° Columna debe considerar solamente un registro del campo 'Nivel_1' por campo Grupo, que corresponde al 'Nivel_1' que tiene mayor venta.&lt;/P&gt;&lt;P&gt;3° Columna debe considerar solamente un registro del campo 'Nivel_2', que corresponde al 'Nivel_2' que tiene mayor venta y que corresponda al 'Nivel_1' seleccionado en la columna 2.&lt;/P&gt;&lt;P&gt;4° Columna debe considerar solamente un registro del campo 'Nivel_3', que corresponde al 'Nivel_3' que tiene mayor venta y que corresponda al 'Nivel_1' seleccionado en la columna 2 y al 'Nivel_2' seleccionado en la columna 3.&lt;/P&gt;&lt;P&gt;5° Columna debe considerar MontoVenta/Cantidad para los registros mostrados con anterioridad.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;I must generate a view in a Pivoting Table or Simple Table that must meet the following requirements:&lt;BR /&gt;1st Column should consider all the 'Groups'.&lt;BR /&gt;2nd Column should consider only a record of the 'Level_1' field &lt;SPAN lang="en"&gt;per Group field&lt;/SPAN&gt;, which corresponds to the 'Level_1' that has the highest sales.&lt;BR /&gt;3 ° Column should consider only one record of the field 'Level_2', which corresponds to 'Level_2' that has the highest sales and that corresponds to 'Level_1' selected in column 2.&lt;BR /&gt;4th Column should consider only a record of the field 'Level_3', which corresponds to 'Level_3' that has the highest sales and that corresponds to 'Level_1' selected in column 2 and to 'Level_2' selected in column 3.&lt;BR /&gt;5th Column must consider MontoVenta / Amount for the records shown previously.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dejo un ejemplo de los datos:&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;I leave an example of the data:)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/209151_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;El resultado esperado:&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;The expected result:)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/209152_pastedImage_5.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usé la sgte. expresión pero solamente me resulta en 'Nivel_1', por otro lado no se donde incluir MontoVenta/Cantidad:&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;I used this expression but it only results in 'Level_1', on the other hand I do not know where to include MontoVenta/Cantidad)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(Nivel_1, -Aggr(Sum ({&amp;lt;Año = {"$(MaxAño)"}&amp;gt;}MontoVenta), Nivel_1, Grupo))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Muchas gracias de antemano disculpen la traducción.&lt;/P&gt;&lt;P&gt;(&lt;SPAN lang="en"&gt;Many thanks in advance, sorry for the translation, Google Translate)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2018 18:33:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136026#M20368</guid>
      <dc:creator>PEyzaguirre</dc:creator>
      <dc:date>2018-07-27T18:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help AGGR() - FirstSortedValue()</title>
      <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136027#M20369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try these expressions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstSortedValue(Nivel_1, -Aggr(Sum(MontoVenta), Nivel_1, Grupo))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstSortedValue(Nivel_2, -(Aggr(NODISTINCT Sum(MontoVenta), Nivel_1, Grupo) + (Aggr(Sum(MontoVenta), Nivel_2, Nivel_1, Grupo)/1E4)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstSortedValue(Nivel_3, -(Aggr(NODISTINCT Sum(MontoVenta), Nivel_1, Grupo) + (Aggr(NODISTINCT Sum(MontoVenta), Nivel_2, Nivel_1, Grupo)/1E4)+(Aggr(NODISTINCT Sum(MontoVenta), Nivel_3, Nivel_2, Nivel_1, Grupo)/1E8)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstSortedValue(Aggr(Sum(MontoVenta), Nivel_1, Nivel_2, Nivel_3), -(Aggr(NODISTINCT Sum(MontoVenta), Nivel_1, Grupo) + (Aggr(NODISTINCT Sum(MontoVenta), Nivel_2, Nivel_1, Grupo)/1E4)+(Aggr(NODISTINCT Sum(MontoVenta), Nivel_3, Nivel_2, Nivel_1, Grupo)/1E8)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/209158_Capture.PNG" style="height: auto;" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:30:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136027#M20369</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-07-27T19:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help AGGR() - FirstSortedValue()</title>
      <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136028#M20370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;Thanks Sunny, I am implementing the expressions with the real data to see if it behaves as it should.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2018 21:04:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136028#M20370</guid>
      <dc:creator>PEyzaguirre</dc:creator>
      <dc:date>2018-07-27T21:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help AGGR() - FirstSortedValue()</title>
      <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136029#M20371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;A href="https://community.qlik.com/qlik-users/2454"&gt;sunny&lt;/A&gt;, the expressions worked perfect. Although I still have a couple of doubts:&lt;BR /&gt;- What does the '/ 1E8' and '/ 1E4' mean if you could explain to me?&lt;BR /&gt;- In what part of the last expression should I consider the formula 'MontoVenta / Cantidad'?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;Gracias&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2018 21:27:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136029#M20371</guid>
      <dc:creator>PEyzaguirre</dc:creator>
      <dc:date>2018-07-27T21:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help AGGR() - FirstSortedValue()</title>
      <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136030#M20372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IE4 = 10000 and IE8 = 100000000 and I am using this to give different sort weights.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't understand your second question? Can you elaborate?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jul 2018 01:21:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136030#M20372</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-07-28T01:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help AGGR() - FirstSortedValue()</title>
      <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136031#M20373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry &lt;A href="https://community.qlik.com/qlik-users/2454"&gt;sunny&lt;/A&gt;, &lt;SPAN lang="en"&gt;I forgot to consider the 'Cantidad' field in the data table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="209163" alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/209163_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;The 4th column must represent the division of 'MontoVenta' by 'Cantidad' (MontoVenta / &lt;SPAN lang="en"&gt;Cantidad&lt;/SPAN&gt;),&lt;BR /&gt;this for the values ​​selected in the columns Group, Level_1, Level_2, Level_3.&lt;/SPAN&gt;&lt;SPAN lang="en"&gt;&lt;IMG __jive_id="209186" alt="" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/209186_pastedImage_3.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank's&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jul 2018 02:28:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136031#M20373</guid>
      <dc:creator>PEyzaguirre</dc:creator>
      <dc:date>2018-07-28T02:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help AGGR() - FirstSortedValue()</title>
      <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136032#M20374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What would be the value of this in the above example?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2018 17:17:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136032#M20374</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-07-30T17:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help AGGR() - FirstSortedValue()</title>
      <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136033#M20375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;Hello Sunny, t&lt;SPAN lang="en"&gt;he values ​​should be 10 and 2.7 respectively, &lt;SPAN lang="en"&gt;But do not worry since I solved it by modifying in the expression Sum(MontoVenta) by Sum(MontoVenta)/Sum(Cantidad)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;I thank you for the help provided.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2018 17:26:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136033#M20375</guid>
      <dc:creator>PEyzaguirre</dc:creator>
      <dc:date>2018-07-30T17:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help AGGR() - FirstSortedValue()</title>
      <link>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136034#M20376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstSortedValue(Aggr(&lt;SPAN style="color: #ff0000;"&gt;Sum(MontoVenta/Cantidad)&lt;/SPAN&gt;, Nivel_1, Nivel_2, Nivel_3), -(Aggr(NODISTINCT Sum(MontoVenta), Nivel_1, Grupo) + (Aggr(NODISTINCT Sum(MontoVenta), Nivel_2, Nivel_1, Grupo)/1E4)+(Aggr(NODISTINCT Sum(MontoVenta), Nivel_3, Nivel_2, Nivel_1, Grupo)/1E8)))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2018 17:32:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-AGGR-FirstSortedValue/m-p/136034#M20376</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-07-30T17:32:52Z</dc:date>
    </item>
  </channel>
</rss>

