<?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 use of max(FIELD,RANK) in script with identical values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/use-of-max-FIELD-RANK-in-script-with-identical-values/m-p/271624#M706918</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to create a table in my script where i have each product, and the sum of sales of the best weeks.&lt;/P&gt;&lt;P&gt;I was using a syntax like :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table0:&lt;/P&gt;&lt;P&gt;select PRODUCT, WEEK, sum(SALES) from SALES;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myTable:&lt;/P&gt;&lt;P&gt;LOAD PRODUCT, numsum( max(SALES,1) , max(SALES,2) , max(SALES,3) , max(SALES,4) ) AS BEST_SALES;&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;P&gt;﻿Unfortunately i just noticed that max(SALES,2) return the second DISTINCT value : if for a product the sales are identical every weeks, my field BEST_SALES will be the sales of one week, and not 4 * one week.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have an idea of a simple way to solve this problem ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jan 2012 16:56:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-01-12T16:56:04Z</dc:date>
    <item>
      <title>use of max(FIELD,RANK) in script with identical values</title>
      <link>https://community.qlik.com/t5/QlikView/use-of-max-FIELD-RANK-in-script-with-identical-values/m-p/271624#M706918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to create a table in my script where i have each product, and the sum of sales of the best weeks.&lt;/P&gt;&lt;P&gt;I was using a syntax like :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table0:&lt;/P&gt;&lt;P&gt;select PRODUCT, WEEK, sum(SALES) from SALES;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myTable:&lt;/P&gt;&lt;P&gt;LOAD PRODUCT, numsum( max(SALES,1) , max(SALES,2) , max(SALES,3) , max(SALES,4) ) AS BEST_SALES;&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;P&gt;﻿Unfortunately i just noticed that max(SALES,2) return the second DISTINCT value : if for a product the sales are identical every weeks, my field BEST_SALES will be the sales of one week, and not 4 * one week.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have an idea of a simple way to solve this problem ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 16:56:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/use-of-max-FIELD-RANK-in-script-with-identical-values/m-p/271624#M706918</guid>
      <dc:creator />
      <dc:date>2012-01-12T16:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: use of max(FIELD,RANK) in script with identical values</title>
      <link>https://community.qlik.com/t5/QlikView/use-of-max-FIELD-RANK-in-script-with-identical-values/m-p/271625#M706919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As i was looking for the exact same thing and have found your question, i will answer on this, even if it's surely a bit too late for you...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've found a way to achieve this using concat and subfield functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;myMaxTable:&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRODUCT,&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subfield(concat(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;SALES,';'&lt;/SPAN&gt;,-&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;SALES&lt;/SPAN&gt;),';',2) as SecondBestSales (Non distinct)&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;RESIDENT &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;my&lt;/SPAN&gt;Table GROUP BY &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;PRODUCT&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I hope it can help other people,&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Br,&lt;/P&gt;&lt;P style="font-size: 12.727272033691406px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Nov 2013 08:43:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/use-of-max-FIELD-RANK-in-script-with-identical-values/m-p/271625#M706919</guid>
      <dc:creator>thomduvi83</dc:creator>
      <dc:date>2013-11-29T08:43:47Z</dc:date>
    </item>
  </channel>
</rss>

