<?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: Case when statement combined with outcome calculation in Qlik Learning Discussions</title>
    <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Case-when-statement-combined-with-outcome-calculation/m-p/673113#M406</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not entirely sure what you're trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not familiar with this notation:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;Total &lt;SPAN style="color: #ff0000;"&gt;-/-&lt;/SPAN&gt; partial amounts = outcome:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;What does -/- signify?&lt;/P&gt;&lt;P&gt;And why is the outcome +1 or -1 only?&lt;/P&gt;&lt;P&gt;Can you explain further?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You say you want to add a case statement.&amp;nbsp; To what?&amp;nbsp; To the script?&amp;nbsp; Or do you want to create a case in an expression in the UI?&lt;/P&gt;&lt;P&gt;If you want to add a case statement in the script, then use the standard SQL case syntax in your Select statement something like this:&lt;/P&gt;&lt;P&gt;SQL SELECT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE @TestVal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 1 THEN 'First'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 2 THEN 'Second'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 3 THEN 'Third'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE 'Other'&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;From TableName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I didn't see you try to put any such case logic in the script so I'm not sure where you want to do your case.&amp;nbsp; Can you explain where you want to create your case statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're trying to add this logic to an expressin in the UI then the correct expression that will work in QlikView would be:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;If([Verplichting_Aanvraag_FreeNumberField_01]-sum([TransactieRegel_Verplichting_BedragIncl]) =&amp;lt; '0' , 'Afgerond',&amp;nbsp; 'Status Verplichting')&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;Finally, your SQL script looks okay to me, what is the problem you're having with it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Aug 2014 15:25:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-08-13T15:25:41Z</dc:date>
    <item>
      <title>Case when statement combined with outcome calculation</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Case-when-statement-combined-with-outcome-calculation/m-p/673112#M405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following issue/question. I have 2 money-fields which I extracted from each other.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Total -/- partial amounts = outcome:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=(Verplichting_Aanvraag_FreeNumberField_01)-sum(TransactieRegel_Verplichting_BedragIncl) = Outcome&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The outcome is (of course) +1 or -1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to add a case when statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Case when (Verplichting_Aanvraag_FreeNumberField_01)-sum(TransactieRegel_Verplichting_BedragIncl) =&amp;lt; '0' then 'Afgerond' else (Verplichting_Aanvraag_FreeNumberField_01)-sum(TransactieRegel_Verplichting_BedragIncl) END as 'Status Verplichting'&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Somehow I can 't fix this and I hope some one can help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;code from my qvw is (my issue in red):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRACE ### Transactieregels Verplichting;&lt;/P&gt;&lt;P&gt;SQL SELECT BedragIncl as &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;TransactieRegel_Verplichting_BedragIncl,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ID&amp;nbsp; as Verplichting_ID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BestelNr as Verplichting_BestelNR&lt;/P&gt;&lt;P&gt;FROM Synergy.dbo.CSCRT_TransactieRegels_View&lt;/P&gt;&lt;P&gt;WHERE BestelNr not like '13032%_'&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRACE ### Transacties Verplichting;&lt;/P&gt;&lt;P&gt;SQL SELECT BoekstukNr as Transactie_Verplichting_Boekstuknummer,&lt;/P&gt;&lt;P&gt;&amp;nbsp; BedragIncl AS Verplichting_Transacties_BedragIncl,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID as Verplichting_ID&lt;/P&gt;&lt;P&gt;FROM Synergy.dbo.CSCRT_Transacties_View&lt;/P&gt;&lt;P&gt;Where BoekstukNr not like '13%_' AND BoekstukNr not like '11%_' AND BoekstukNr not like '12%_'&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRACE ### Verzoeken Verplichting Type 200;&lt;/P&gt;&lt;P&gt;SQL SELECT Description as Verplichting_BestelNR,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID as Verplichting_ID_Verzoek,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FLOOR (cast(syscreated - getdate() as float)*-1) as Verplichting_Ouderdom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; syscreated as Bestelbonregel_Verplichting_syscreated&lt;/P&gt;&lt;P&gt;FROM Synergy.dbo.Absences&lt;/P&gt;&lt;P&gt;Where Type = '200'&lt;/P&gt;&lt;P&gt;and Description not like '13032%_'&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRACE ### Verzoeken Verplichting Type 204;&lt;/P&gt;&lt;P&gt;SQL SELECT FreeguidField_01 as Verplichting_ID_Verzoek,&lt;/P&gt;&lt;P&gt;RelatedRequestID as Verplichting_Aanvraag_ID&lt;/P&gt;&lt;P&gt;FROM Synergy.dbo.Absences&lt;/P&gt;&lt;P&gt;Where type in (204)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRACE ### Verzoeken Verplichting Type 201 202 203;&lt;/P&gt;&lt;P&gt;SQL SELECT ID as Verplichting_Aanvraag_ID,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;FreeNumberField_01 as Verplichting_Aanvraag_FreeNumberField_01&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;FROM Synergy.dbo.Absences&lt;/P&gt;&lt;P&gt;Where type in (201, 202, 203) AND Status &amp;lt;&amp;gt; '2'&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Aug 2014 12:19:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Case-when-statement-combined-with-outcome-calculation/m-p/673112#M405</guid>
      <dc:creator />
      <dc:date>2014-08-13T12:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Case when statement combined with outcome calculation</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Case-when-statement-combined-with-outcome-calculation/m-p/673113#M406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not entirely sure what you're trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not familiar with this notation:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;Total &lt;SPAN style="color: #ff0000;"&gt;-/-&lt;/SPAN&gt; partial amounts = outcome:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;What does -/- signify?&lt;/P&gt;&lt;P&gt;And why is the outcome +1 or -1 only?&lt;/P&gt;&lt;P&gt;Can you explain further?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You say you want to add a case statement.&amp;nbsp; To what?&amp;nbsp; To the script?&amp;nbsp; Or do you want to create a case in an expression in the UI?&lt;/P&gt;&lt;P&gt;If you want to add a case statement in the script, then use the standard SQL case syntax in your Select statement something like this:&lt;/P&gt;&lt;P&gt;SQL SELECT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE @TestVal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 1 THEN 'First'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 2 THEN 'Second'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN 3 THEN 'Third'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE 'Other'&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;From TableName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I didn't see you try to put any such case logic in the script so I'm not sure where you want to do your case.&amp;nbsp; Can you explain where you want to create your case statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're trying to add this logic to an expressin in the UI then the correct expression that will work in QlikView would be:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;If([Verplichting_Aanvraag_FreeNumberField_01]-sum([TransactieRegel_Verplichting_BedragIncl]) =&amp;lt; '0' , 'Afgerond',&amp;nbsp; 'Status Verplichting')&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;Finally, your SQL script looks okay to me, what is the problem you're having with it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Aug 2014 15:25:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Case-when-statement-combined-with-outcome-calculation/m-p/673113#M406</guid>
      <dc:creator />
      <dc:date>2014-08-13T15:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Case when statement combined with outcome calculation</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Case-when-statement-combined-with-outcome-calculation/m-p/673114#M407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Terry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I meant: &lt;STRONG style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f6f6f6;"&gt;Total &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;-&lt;/SPAN&gt; partial amounts = outcome&lt;/STRONG&gt; (just the sum). With the +1 or -1 I meant a positive or a negative amount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't know what was the best place to put the statement, so I was waiting for som advice, BUT putting it in the expression is the solution for now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f6f6f6;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;If([Verplichting_Aanvraag_FreeNumberField_01]-sum([TransactieRegel_Verplichting_BedragIncl]) =&amp;lt; '0' , 'Afgerond',&amp;nbsp; 'Status Verplichting')&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f6f6f6;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f6f6f6;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kees-Jan&lt;EM style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f6f6f6;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 06:32:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Case-when-statement-combined-with-outcome-calculation/m-p/673114#M407</guid>
      <dc:creator />
      <dc:date>2014-08-14T06:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Case when statement combined with outcome calculation</title>
      <link>https://community.qlik.com/t5/Qlik-Learning-Discussions/Case-when-statement-combined-with-outcome-calculation/m-p/673115#M408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Terry or anyone else, can you help me out on my question &lt;A href="https://community.qlik.com/message/647420"&gt;Month and Year from Date Field&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 08:21:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Learning-Discussions/Case-when-statement-combined-with-outcome-calculation/m-p/673115#M408</guid>
      <dc:creator>djsampat</dc:creator>
      <dc:date>2014-11-03T08:21:48Z</dc:date>
    </item>
  </channel>
</rss>

