<?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: Agrupamentos e Somas in Brasil</title>
    <link>https://community.qlik.com/t5/Brasil/Agrupamentos-e-Somas/m-p/891586#M29711</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set Analysis não faz comparação linha a linha como você espera, ele sempre resolve o cálculo para a tabela.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tente fazer algo desse tipo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM( &lt;/P&gt;&lt;P&gt;&amp;nbsp; if( &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;DATA_COMPRA&lt;/SPAN&gt;= Aggr( Nodistinct Max( &lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;DATA_COMPRA&lt;/SPAN&gt; ), &lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;ID_PRODUTO&lt;/SPAN&gt;), &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;VALOR_COMPRA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2015 11:41:00 GMT</pubDate>
    <dc:creator>nicolett_yuri</dc:creator>
    <dc:date>2015-05-07T11:41:00Z</dc:date>
    <item>
      <title>Agrupamentos e Somas</title>
      <link>https://community.qlik.com/t5/Brasil/Agrupamentos-e-Somas/m-p/891585#M29710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Boa tarde.&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Estou enfrentando uma dificuldade e gostaria de saber se alguém já passou por isto e conseguiu selecionar.&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Eu tenho uma tabela com ID_PRODUTO, DATA_COMPRA, VALOR_COMPRA.&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Preciso fazer Sum(Valor_compra) onde Data_Compra = Max(Data_compra).&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Minha dimensão é ID_PRODUTO e a expressão é "=sum({&amp;lt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;DATA_COMPRA&lt;/SPAN&gt; = {'$(=max(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;DATA_COMPRA&lt;/SPAN&gt;))'}&amp;gt;} VALOR_COMPRA)"&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Porém ele retorna a soma de valor_compra de MAX(Data_Compra) da tabela toda, e não de Max(Data_Compra) de cada produto:&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;&lt;IMG alt="evidencia.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/85854_evidencia.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Nem todos os produtos são comprados no mesmo dia e eu preciso obter o ultimo valor pago na compra.&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Alguém poderia me ajudar?&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Muito obrigado,&lt;/P&gt;&lt;P style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;Renato Adolfs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 20:58:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Brasil/Agrupamentos-e-Somas/m-p/891585#M29710</guid>
      <dc:creator />
      <dc:date>2015-05-06T20:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Agrupamentos e Somas</title>
      <link>https://community.qlik.com/t5/Brasil/Agrupamentos-e-Somas/m-p/891586#M29711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set Analysis não faz comparação linha a linha como você espera, ele sempre resolve o cálculo para a tabela.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tente fazer algo desse tipo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM( &lt;/P&gt;&lt;P&gt;&amp;nbsp; if( &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;DATA_COMPRA&lt;/SPAN&gt;= Aggr( Nodistinct Max( &lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;DATA_COMPRA&lt;/SPAN&gt; ), &lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;ID_PRODUTO&lt;/SPAN&gt;), &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;VALOR_COMPRA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 11:41:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Brasil/Agrupamentos-e-Somas/m-p/891586#M29711</guid>
      <dc:creator>nicolett_yuri</dc:creator>
      <dc:date>2015-05-07T11:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Agrupamentos e Somas</title>
      <link>https://community.qlik.com/t5/Brasil/Agrupamentos-e-Somas/m-p/891587#M29712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set Analysis são avaliados antes das quebras do gráfico, como disse o Yuri, não é avaliado linha a linha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Uma solução seria utilizar&lt;/P&gt;&lt;P&gt;FIRSTSORTEDVALUE(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AGGR(SUM(&lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px;"&gt;VALOR_COMPRA),&lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 13.3333330154419px;"&gt;DATA_COMPRA),&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-size: 13.3333330154419px; font-family: Helvetica, Arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &lt;SPAN style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 13.3333330154419px;"&gt;DATA_COMPRA&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 12:38:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Brasil/Agrupamentos-e-Somas/m-p/891587#M29712</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2015-05-07T12:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Agrupamentos e Somas</title>
      <link>https://community.qlik.com/t5/Brasil/Agrupamentos-e-Somas/m-p/891588#M29713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Obrigado, pessoal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Utilizei a solução do Yuri e deu certo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Muito obrigado mesmo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Atenciosamente,&lt;/P&gt;&lt;P&gt;Renato Adolfs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 15:59:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Brasil/Agrupamentos-e-Somas/m-p/891588#M29713</guid>
      <dc:creator />
      <dc:date>2015-05-20T15:59:35Z</dc:date>
    </item>
  </channel>
</rss>

