<?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 Sum only different values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225194#M77533</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Follow attached is an example.&lt;BR /&gt;&lt;BR /&gt;I want to check the values in the colum A, and sum the valus in the colum B.&lt;/P&gt;&lt;P&gt;In the example, I'm suming the distinct values in the colum B. But it's wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How Can I do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Apr 2011 20:11:26 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-04-20T20:11:26Z</dc:date>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225191#M77530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;How can I make QlikView to sum only the different values in the collumn B?&lt;/P&gt;&lt;P&gt;Check the example:&lt;/P&gt;&lt;P&gt;Column A | Column B&lt;/P&gt;&lt;P&gt;10 | 5&lt;BR /&gt;10 | 6&lt;BR /&gt;10 | 5&lt;BR /&gt;11 | 1&lt;BR /&gt;11 | 2&lt;BR /&gt;13 | 8&lt;BR /&gt;13 | 6&lt;BR /&gt;13 | 3&lt;BR /&gt;13 | 0&lt;/P&gt;&lt;P&gt;I would like to sum only 5+1+8, that will be 14&lt;BR /&gt;Actually, the result is: 5+6+5+1+2+8+6+3+0 = 36&lt;/P&gt;&lt;P&gt;So, how can I do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 18:55:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225191#M77530</guid>
      <dc:creator />
      <dc:date>2011-04-20T18:55:10Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225192#M77531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try&lt;/P&gt;&lt;P&gt;SUM(DISTINCT YOUR_FIELD)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 18:59:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225192#M77531</guid>
      <dc:creator />
      <dc:date>2011-04-20T18:59:49Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225193#M77532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Érico,&lt;/P&gt;&lt;P&gt;I'm not sure if it will really solve my problem, because the colum that I want to sum is not the same of the one that will contain the criteria (values do be checked if it's different or not).&lt;/P&gt;&lt;P&gt;In the column A I have the filed criteria, and in the colum B I have the values to be sumed if the colum A value is different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your attention&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 19:23:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225193#M77532</guid>
      <dc:creator />
      <dc:date>2011-04-20T19:23:10Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225194#M77533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Follow attached is an example.&lt;BR /&gt;&lt;BR /&gt;I want to check the values in the colum A, and sum the valus in the colum B.&lt;/P&gt;&lt;P&gt;In the example, I'm suming the distinct values in the colum B. But it's wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How Can I do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 20:11:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225194#M77533</guid>
      <dc:creator />
      <dc:date>2011-04-20T20:11:26Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225195#M77534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don´t know what´s your rule, i don´t understand your example.....you sum just 5 + 1 + 8 and have another values differente than column A lile third line....value 6....&lt;/P&gt;&lt;P&gt;You can do something ike this...depends your rule....&lt;/P&gt;&lt;P&gt;SUM( IF(Column B &amp;lt;&amp;gt; Column A, Column B))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 20:17:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225195#M77534</guid>
      <dc:creator />
      <dc:date>2011-04-20T20:17:59Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225196#M77535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll try to be less confused. &lt;IMG alt="Smile" src="http://community.qlik.com/emoticons/emotion-1.gif" /&gt;&lt;/P&gt;&lt;P&gt;I have 2 columns. The column A and the column B.&lt;BR /&gt;In the column A I have the code and in the column B I have the value.&lt;/P&gt;&lt;P&gt;The system that generate this excel file is very complex and they do this logic:&lt;BR /&gt;In the first line they give you the total value, and in the next lines they specify the values of all the services realized that compose the total value in the first line.&lt;/P&gt;&lt;P&gt;Check this example:&lt;/P&gt;&lt;P&gt;Column A | Column B | Description&lt;BR /&gt;56 | 100 | Car service&lt;BR /&gt;56 | 30 | Washing&lt;BR /&gt;56 | 20 | Cleaning&lt;BR /&gt;56 | 50 | Repair&lt;BR /&gt;57 | 15 | Tire replacement&lt;BR /&gt;57 | 10 | 2 Tires&lt;BR /&gt;57 | 05 |Balancing&lt;/P&gt;&lt;P&gt;So, I can't sum all the values (100+30+20+50+15+10+05) coz I would be duplicating the values. What I need to do is: Sum only the first different value in the column A. (100+15)&lt;/P&gt;&lt;P&gt;The values after the first different value in the columbn A, just describes the total amount.&lt;/P&gt;&lt;P&gt;So, how can I sum, in the column B, only the first different values in the columbn A?&lt;/P&gt;&lt;P&gt;Is is clear now?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your attention,&lt;BR /&gt;Best regards;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 20:29:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225196#M77535</guid>
      <dc:creator />
      <dc:date>2011-04-20T20:29:23Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225197#M77536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Clear now.....you wanna take just a "Total" values....same the first line each code.....ok?&lt;/P&gt;&lt;P&gt;You have a lot of options....&lt;/P&gt;&lt;P&gt;You can try on load.....make a flag on that lines (Total) if always be on the first line....&lt;/P&gt;&lt;P&gt;on the load you can create a nem column for a flag.....use a rule like this&lt;/P&gt;&lt;P&gt;IF(Column A &amp;lt;&amp;gt; PREVIOUS(Column A), 'TOTAL') AS FLAG&lt;/P&gt;&lt;P&gt;and in your aplication......&lt;/P&gt;&lt;P&gt;SUM(IF(FLAG='Total', Column B))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A litle bit confused....hope it helps you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 20:40:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225197#M77536</guid>
      <dc:creator />
      <dc:date>2011-04-20T20:40:36Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225198#M77537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For your specific example, consider sum("Column B")/2. If the details always add up to the total, then the simple sum is always twice as big as it should be, so just divide by 2.&lt;/P&gt;&lt;P&gt;The flag approach would probably give better performance, though, at least if you use set analysis.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum({&amp;lt;FLAG={'Total'}&amp;gt;} "Column B")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 20:55:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225198#M77537</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2011-04-20T20:55:35Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225199#M77538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Érico,&lt;/P&gt;&lt;P&gt;Acabei de ver que você é brasileiro, então acho melhor conversarmos emportuguês!&lt;/P&gt;&lt;P&gt;Então, o que acontece é o seguinte. Eu tenho na coluna A o código e na coluna B o valor.&lt;/P&gt;&lt;P&gt;Porém por regra do sistema, ao fazer a extração ele sempre carrega nesta ordem:&lt;/P&gt;&lt;P&gt;Coluna A | Coluna B | Descrição&lt;BR /&gt;30 | 100 | Carro&lt;BR /&gt;30 | 40 | Lavagem&lt;BR /&gt;30 | 60 | Higienização&lt;BR /&gt;31 | 400 | Compra de avião&lt;BR /&gt;31 | 200 | ERJ-145&lt;BR /&gt;31 | 200 | Phenom 100&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Ou seja, na primeira linha temos o código 30 que diz respeito a algo efetuado em um carro que custou 100 reais. Então na próxima linha ainda temos o código 30 e o valor 40 reais que se refere a lavagem e na próxima linha o valor de 60 reais que refere a uma higienização. Ou seja as duas próximas linhas descrevem o componente dos 100 reais. Ou seja, os 100 reais de gasto que tivemos foi dividido em 40 para lavagem + 60 para higienização.&lt;/P&gt;&lt;P&gt;Já na próxima linha temos o código 31, ou seja é uma nova tarefa que não diz mais respeito a 30. e custou 400 reais. as duas linhas subsequentes descrevem o que aconteceu. Sendo 200 reais para a compra de um ERJ e 200 para a compra de um Phenom 100.&lt;/P&gt;&lt;P&gt;Portanto eu não posso somar tudo (100+40+60+400+200+200) porque o primeiro 100 já é a soma de 40+60 e o 400 já é a soma de 200+200. Portanto eu devo somar só o 100+400.&lt;/P&gt;&lt;P&gt;A regra seria: Somar os primeiros valores na coluna B que tiverem um valor na coluna A diferente do valor da coluna a -1.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Acho que agora está um pouco mais claro,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Desculpe por te atrapalhar tanto, é que preciso muito disso!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Muito obrigado;&lt;BR /&gt;Boa tarde&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 20:57:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225199#M77538</guid>
      <dc:creator />
      <dc:date>2011-04-20T20:57:59Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225200#M77539</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;I solved it by a inter-record analysis on the script.&lt;/P&gt;&lt;P&gt;Please, check the file attached.&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(P.S I'm also from Brasil)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Apr 2011 21:18:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225200#M77539</guid>
      <dc:creator>erichshiino</dc:creator>
      <dc:date>2011-04-20T21:18:48Z</dc:date>
    </item>
    <item>
      <title>Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225201#M77540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you do me an example using an excel file voz it's still not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2011 12:30:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225201#M77540</guid>
      <dc:creator />
      <dc:date>2011-04-25T12:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sum only different values</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225202#M77541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oi Kelly,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Entendi seu problema logo de cara, mas como entrei a pouco tempo na comunidade, somente agora encontrei sua dúvida. Acredito que você já tenha encontrado uma solução, pois a ferramenta possui inúmeras delas para solucionar o seu problema. O próprio Éric já havia dado uma solução e por isso vou corroborar com ele. Aproveitei os mesmos dados que você colocou como exemplo e fiz o script abaixo:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VALUES_ORIGEM:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;Coluna_A, Coluna_B, Descrição&lt;/P&gt;&lt;P&gt;30 , 100 , 'Carro'&lt;/P&gt;&lt;P&gt;30 ,&amp;nbsp; 40 , 'Lavagem'&lt;/P&gt;&lt;P&gt;30 ,&amp;nbsp; 60 , 'Higienização'&lt;/P&gt;&lt;P&gt;31 , 400 , 'Compra de avião'&lt;/P&gt;&lt;P&gt;31 , 200 , 'ERJ-145'&lt;/P&gt;&lt;P&gt;31 , 200 , 'Phenom 100'&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VALUES_CALCULADO:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Coluna_A,&lt;/P&gt;&lt;P&gt;Coluna_B,&lt;/P&gt;&lt;P&gt;Descrição,&lt;/P&gt;&lt;P&gt;If(Previous(Coluna_A) &amp;lt;&amp;gt; Coluna_A,'Total') as Total&lt;/P&gt;&lt;P&gt;Resident VALUES_ORIGEM;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Após a carga você cria uma tabela dinâmica, cria uma expressão com a seguinte definição:&lt;/P&gt;&lt;P&gt;=SUM({$&amp;lt;Total={'Total'}&amp;gt;}Coluna_B)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Espero ter ajudado mesmo que tardiamente!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Abraço e sucesso!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gilberto Medeiros&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2015 23:43:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-only-different-values/m-p/225202#M77541</guid>
      <dc:creator>gilbertomedeiro</dc:creator>
      <dc:date>2015-07-18T23:43:09Z</dc:date>
    </item>
  </channel>
</rss>

