<?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: Tricky - Defining the 'four cheapest' products in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648724#M594301</link>
    <description>&lt;P&gt;Why would you not include 00273689?&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2019 19:45:06 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-11-19T19:45:06Z</dc:date>
    <item>
      <title>Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648463#M594292</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I am facing a very special challenge: I need to develop a solution where the among a long list of products the "four cheapest" products will be determined. Here are examples to explain how the "four cheapest" are defined:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Examples_four_cheapest.JPG" style="width: 610px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/23938i8BA45D581372D4F9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Examples_four_cheapest.JPG" alt="Examples_four_cheapest.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried approaches with min-, FirstSortedValue- and rank formulas, but didn't quite solve this. Now I appreciate your ideas. Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:54:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648463#M594292</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2024-11-16T01:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648467#M594293</link>
      <description>&lt;P&gt;I believe FirstSortedValue should work... can you share what you tried?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 12:02:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648467#M594293</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-19T12:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648634#M594295</link>
      <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;the problem with firstsortedvalue is that it generates a NULL value when there is more than one product with the same price, that's why I dumped this approach ( I don't have the scripting anymore). One can overcome this by adding distinct, but then all other products with the same price get kicked out of the definition of the 4 cheapest products...&lt;/P&gt;&lt;P&gt;Ingo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 15:42:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648634#M594295</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2019-11-19T15:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648700#M594296</link>
      <description>&lt;P&gt;So what would you like to see when there are multiple products? Concat them all?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 18:50:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648700#M594296</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-19T18:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648707#M594298</link>
      <description>&lt;P&gt;Well yes, according to the definition of the 'four cheaptest'.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 19:02:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648707#M594298</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2019-11-19T19:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648713#M594299</link>
      <description>&lt;P&gt;May be something like this... this is a very general formula because I don't really know how your data looks like... I am making a lot of assumptions here which may or may not be true (like there is only one price per product)&lt;/P&gt;&lt;P&gt;Concat(Aggr(If(Price = Min(TOTAL Price), Product), Product))&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 19:17:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648713#M594299</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-19T19:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648722#M594300</link>
      <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;unfortunately, this suggestion doesn*t take into account that there might be products with exactly the same price. See a real example below where I tried to make the background colour yellow for those products belonging to the group of the 'four cheapest' with the following formula:&lt;/P&gt;&lt;P&gt;=if(Price=min(total Price, 1), yellow(), if(Price=min(total Price, 2), yellow(), if(Price=min(total Price, 3), yellow(), if(Price=min(total Price, 4), yellow()))))&lt;/P&gt;&lt;P&gt;However, the products with the prices that actually should be in yellow are encircled in red. Do you see what I need?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Examples_four_cheapest_3.jpg" style="width: 287px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/23991iF8E23E574244C4D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Examples_four_cheapest_3.jpg" alt="Examples_four_cheapest_3.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 19:41:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648722#M594300</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2019-11-19T19:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648724#M594301</link>
      <description>&lt;P&gt;Why would you not include 00273689?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 19:45:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648724#M594301</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-19T19:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648727#M594302</link>
      <description>&lt;P&gt;Exactly, as defined in the examples in the table above. If every product had a different price this would be an easy game.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 19:53:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648727#M594302</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2019-11-19T19:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648729#M594303</link>
      <description>&lt;P&gt;Helping you seems like I am trying to solve a riddle :). Would you be able to put a small mock Excel file so that we can see the kind of data you have and clearly lay out the output you are looking to get from it.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 19:55:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648729#M594303</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-19T19:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648732#M594304</link>
      <description>&lt;P&gt;Sorry, I know this is hard to understand &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp; I didn*t come up with this rules. The best I can think of to explain what is required is taking you back to the examples from above.&lt;/P&gt;&lt;P&gt;If there are exactly 4 products with the same price then these are the '4 cheaptest'. However, if there are less than four products with the same cheapest price then the next group of products with the second lowest price are included and so on...&lt;/P&gt;&lt;P&gt;Sorry, I really don't have a better explanation.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Examples_four_cheapest.JPG" style="width: 610px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/23992iD6A3073F8D763F1A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Examples_four_cheapest.JPG" alt="Examples_four_cheapest.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 20:11:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648732#M594304</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2019-11-19T20:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648733#M594305</link>
      <description>&lt;P&gt;I understand the explanation part, all I need is a mocked up data to test a solution which will work for you.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 20:13:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648733#M594305</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-19T20:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648735#M594306</link>
      <description>&lt;P&gt;I see. Here you go.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 20:24:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648735#M594306</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2019-11-19T20:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648740#M594307</link>
      <description>&lt;P&gt;Create a variable which decides what is the smallest number of min price which will take you to at least 4 products. I call the variable vCheck (feel free to call it something else)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;If(Count({&amp;lt;Price = {"$(=Min(Price))"}&amp;gt;}Price) &amp;gt;= 4, 1,
If(Count({&amp;lt;Price = {"&amp;lt;=$(=Min(Price, 2))"}&amp;gt;}Price) &amp;gt;= 4, 2,
If(Count({&amp;lt;Price = {"&amp;lt;=$(=Min(Price, 3))"}&amp;gt;}Price) &amp;gt;= 4, 3, 4)))&lt;/LI-CODE&gt;&lt;P&gt;Now you can use this in your set analysis&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{&amp;lt;Price = {"&amp;lt;=$(=Min(Price, $(vCheck)))"}&amp;gt;}&lt;/LI-CODE&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 503px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/23993i4FD33FF5B10B3761/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 20:45:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1648740#M594307</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-19T20:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649233#M594308</link>
      <description>&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;thanks for your suggestions. However, my result looks different, see below. No idea why!?&lt;/P&gt;&lt;P&gt;And there is another challenge: I need to use the if...else clause in the object, not in the script, since primarily a subgroup will be selected from which the 4 cheapest need to be determined ad hoc... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="4 cheapest.JPG" style="width: 468px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/24083i75C9A19646EB6111/image-size/large?v=v2&amp;amp;px=999" role="button" title="4 cheapest.JPG" alt="4 cheapest.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:45:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649233#M594308</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2019-11-20T15:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649240#M594309</link>
      <description>&lt;P&gt;1) It has to do with the formatting, I am not sure how exactly is Price formatted which is why you don't see a result&lt;/P&gt;&lt;P&gt;2) What did I change in the script? I mentioned a variable... but nothing&amp;nbsp; changed in the script... my script was just this?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 836px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/24085iA4F63F39BE84D37C/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:53:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649240#M594309</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-20T15:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649244#M594310</link>
      <description>&lt;P&gt;I thought you defined a variable like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;SET vCheck=If(Count({&amp;lt;Price = {"$(=Min(Price))"}&amp;gt;}Price) &amp;gt;= 4, 1, If(Count({&amp;lt;Price = {"&amp;lt;=$(=Min(Price, 2))"}&amp;gt;}Price) &amp;gt;= 4, 2, If(Count({&amp;lt;Price = {"&amp;lt;=$(=Min(Price, 3))"}&amp;gt;}Price) &amp;gt;= 4, 3, 4)));&lt;/P&gt;&lt;P&gt;If not, how did you do it?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:58:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649244#M594310</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2019-11-20T15:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649267#M594311</link>
      <description>&lt;P&gt;Added it directly on the front end within variable overview&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 685px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/24092i8135823C6B46028F/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:31:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649267#M594311</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-11-20T16:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky - Defining the 'four cheapest' products</title>
      <link>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649701#M594312</link>
      <description>&lt;P&gt;I had to adapt it to my needs a little bit, but now it works like a charm! Many thanks, Sunny! Great solution!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 15:12:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Tricky-Defining-the-four-cheapest-products/m-p/1649701#M594312</guid>
      <dc:creator>ingoniclas</dc:creator>
      <dc:date>2019-11-21T15:12:27Z</dc:date>
    </item>
  </channel>
</rss>

