<?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: Sum sold quantity for different prices for a same product SKU in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Sum-sold-quantity-for-different-prices-for-a-same-product-SKU/m-p/2052067#M86490</link>
    <description>&lt;P&gt;Perhaps I am misunderstanding your data structure, but if you have a list of sales lines, and each of them has a quantity and a price, wouldn't this be a pivot table with the Price field as the pivot dimension?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2023 13:57:15 GMT</pubDate>
    <dc:creator>Or</dc:creator>
    <dc:date>2023-03-22T13:57:15Z</dc:date>
    <item>
      <title>Sum sold quantity for different prices for a same product SKU</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-sold-quantity-for-different-prices-for-a-same-product-SKU/m-p/2051719#M86466</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;I've been asked to display the sold quantity of a product SKU for different price ranges this SKU have been sold.&lt;/P&gt;
&lt;P&gt;The problem is that I need to display the different prices in columns, instead of lines. It means that for each Price column I need a corresponding column for the quantity, as shown in the picture below (expected result).&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-center" image-alt="5c61788277a61d84febdb028c011b19f.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/103234i8A1ED7330194DDBC/image-size/large?v=v2&amp;amp;px=999" role="button" title="5c61788277a61d84febdb028c011b19f.png" alt="5c61788277a61d84febdb028c011b19f.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each product has a same "reference code" that might hold different SKUs and a different "Original Price" (the first price registration).&lt;/P&gt;
&lt;P&gt;The data model already holds a field record for each different price the product was sold, with that said I managed to show the different prices using FirstSortedValue by specifying the rank order (1 for Price 1 / 2 for Price 2 / etc.), but I can't make the calculation correspond to the Price X, it either sums everything or it shows only for 1 line if I add FirstSortedValue inside a set analysis.&lt;/P&gt;
&lt;DIV id="tinyMceEditortherealdees_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;I assume I have to work with Aggr and Sum. I tried different combinations, but I just can't get it to work.&lt;/P&gt;
&lt;P&gt;The closest I got was this, but it only shows the correct value for a single line:&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;NFTipoMovimento = {'Venda'}, PrecoEpoca = {"$(=(FirstSortedValue(Distinct PrecoEpoca, PrecoEpoca, 1)))"} &amp;gt;} [ProdutoQuantidade])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS:&lt;/P&gt;
&lt;P&gt;PrecoEpoca = Different price ranges the product has been sold&lt;/P&gt;
&lt;P&gt;ProdutoQuantidade = Units solds&lt;/P&gt;
&lt;P&gt;ProdutoReferencia = Reference code (1 level above SKU)&lt;/P&gt;
&lt;P&gt;%ProdutoSKU = SKU code&lt;/P&gt;
&lt;P&gt;PrecoOriginal = First price registration for that SKU&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is appreciated.&lt;/P&gt;
&lt;P&gt;SOS&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:16:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-sold-quantity-for-different-prices-for-a-same-product-SKU/m-p/2051719#M86466</guid>
      <dc:creator>pedrohenriqueperna</dc:creator>
      <dc:date>2023-03-21T17:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sum sold quantity for different prices for a same product SKU</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-sold-quantity-for-different-prices-for-a-same-product-SKU/m-p/2052067#M86490</link>
      <description>&lt;P&gt;Perhaps I am misunderstanding your data structure, but if you have a list of sales lines, and each of them has a quantity and a price, wouldn't this be a pivot table with the Price field as the pivot dimension?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 13:57:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-sold-quantity-for-different-prices-for-a-same-product-SKU/m-p/2052067#M86490</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2023-03-22T13:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sum sold quantity for different prices for a same product SKU</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-sold-quantity-for-different-prices-for-a-same-product-SKU/m-p/2052115#M86493</link>
      <description>&lt;P&gt;Hey!&lt;/P&gt;
&lt;P&gt;Thank you for the reply.&lt;/P&gt;
&lt;P&gt;It crossed my mind to use a pivot table, but I thought it wouldn't give me the expected result.&lt;/P&gt;
&lt;P&gt;I've just played a bit with it and I think it might be the solution indeed.&lt;/P&gt;
&lt;P&gt;Thanks for the tip!!!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 15:06:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-sold-quantity-for-different-prices-for-a-same-product-SKU/m-p/2052115#M86493</guid>
      <dc:creator>pedrohenriqueperna</dc:creator>
      <dc:date>2023-03-22T15:06:47Z</dc:date>
    </item>
  </channel>
</rss>

