<?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: Calculating with case statement problems in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculating-with-case-statement-problems/m-p/613697#M226440</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sena,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are trying to use a case statement like approach its better for you to do this in script with a mapping table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;MappingTable:&lt;/P&gt;&lt;P&gt;MAPPING LOAD&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo],[Mapping]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;FROM....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;In your load statement write this expression&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;applymap('MappingTable',&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo],&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo]&lt;/SPAN&gt;) as &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;An alternative is to use a pick(match()) function as opposed to using a&amp;nbsp; lot of if statements&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;i.e. pick(match(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo]&lt;/SPAN&gt;,1,2,3,4,5,6.....),'One','Two','Three','Four'......)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Mar 2014 11:33:22 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-03-07T11:33:22Z</dc:date>
    <item>
      <title>Calculating with case statement problems</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-with-case-statement-problems/m-p/613696#M226439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use something similar a case statement function, and it works, but not always. I explain myself. This function works when all dimensions are expanded, but if any of that dimensions are not expanded, the result are not working properly. I have been several hours trying but i can't understand why this happens. The obvious is that, when there is a dimension which is not expanded, it uses the acumulated values, instead of each [Clave Expediente] values (this is they key of the table). If I expand everything, it calculates for each [Clave Expediente] and works as it should. Any help with that? Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;count(DISTINCT [Clave Expediente])&lt;/P&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;P&gt;if(match([Tipo de Encargo],'TAS01'), pond_TAS01,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de Encargo],'TAS02'), pond_TAS02,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de Encargo],'TAS03'), pond_TAS03,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de Encargo],'EST01'), pond_EST01,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de Encargo],'EST02'), pond_EST02,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de Encargo],'INF01'), pond_INF01,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de Encargo],'INF02'), pond_INF02,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de Encargo],'INF03'), pond_INF03,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de Encargo],'MOD05'), pond_MOD05,&lt;/P&gt;
&lt;P&gt;1)))))))))&lt;/P&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'APARCAMIENTOS Y TRASTEROS'), pond_aparcamientos,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'RESIDENCIAL'), pond_residencial,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'COMERCIAL'), pond_comercial,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'INDUSTRIAL'), pond_industrial,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'OFICINAS'), pond_oficinas,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'EXPLOTACIONES&amp;nbsp; "ALOJAMIENTO"'), pond_explotaciones,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'EXPLOTACIONES&amp;nbsp; "SECTOR AGRARIO"'), pond_explotacionsrustica,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'FINCAS RUSTICAS'), pond_rusticas,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'OTRAS EXPLOTACIONES'), pond_explotaciones,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'SOLARES Y TERRENO'), pond_suelos,&lt;/P&gt;
&lt;P&gt;if(match([Tipo de bien],'BIENES MUEBLES'), pond_bienesmuebles,&lt;/P&gt;
&lt;P&gt;1)))))))))))&lt;/P&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;P&gt;if(match([Rol],'Tecnico/a'), pond_TEC,&lt;/P&gt;
&lt;P&gt;if(match([Rol],'Supervisor/a'), pond_SUP,&lt;/P&gt;
&lt;P&gt;if(match([Rol],'Supervisor/a Superior'), pond_SUPSUP,&lt;/P&gt;
&lt;P&gt;1)))&lt;/P&gt;
&lt;P&gt;*&lt;/P&gt;
&lt;P&gt;if([Valor de Mercado] &amp;lt; rango_VM1, pond_VM1,&lt;/P&gt;
&lt;P&gt;if([Valor de Mercado] &amp;lt; rango_VM2, pond_VM2, pond_VM3))&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 11:28:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-with-case-statement-problems/m-p/613696#M226439</guid>
      <dc:creator />
      <dc:date>2014-03-07T11:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating with case statement problems</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-with-case-statement-problems/m-p/613697#M226440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sena,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are trying to use a case statement like approach its better for you to do this in script with a mapping table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;MappingTable:&lt;/P&gt;&lt;P&gt;MAPPING LOAD&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo],[Mapping]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;FROM....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;In your load statement write this expression&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;applymap('MappingTable',&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo],&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo]&lt;/SPAN&gt;) as &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;An alternative is to use a pick(match()) function as opposed to using a&amp;nbsp; lot of if statements&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;i.e. pick(match(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Tipo de Encargo]&lt;/SPAN&gt;,1,2,3,4,5,6.....),'One','Two','Three','Four'......)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 11:33:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-with-case-statement-problems/m-p/613697#M226440</guid>
      <dc:creator />
      <dc:date>2014-03-07T11:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating with case statement problems</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-with-case-statement-problems/m-p/613698#M226441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Byron, thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "if statements" bucle are working nicely, so I really don't need to change it if it is not necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also can't use applymap in scripting as there is lot of scripts in the project, as far as the variables "pond_XXXX" are customized by the user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My only problem is about the results, as they are correct only depending on the graphic used. In a flat table with every dimension expanded, the calculation works perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, but i am afraid i can't explain better with that, not a pro in Qlikview neither in English.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 11:57:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-with-case-statement-problems/m-p/613698#M226441</guid>
      <dc:creator />
      <dc:date>2014-03-07T11:57:54Z</dc:date>
    </item>
  </channel>
</rss>

