<?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 IF AND in a calculated field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880144#M1216815</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to create a new column in my table using the 'Calculated field'. It works fine with one condition ([RAG]), but when I try to use two other columns (i.e. two fields [RAG] and [CAUSE]) to create the output of the calculated filed, I don't get anything. I've tried the following, which doesn't work. Thoughts?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[RAG]='Green',&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;'Green,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (([RAG]='Red') AND ([CAUSE]='Cancelled')),&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Cancelled',&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Red'&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jan 2022 14:07:42 GMT</pubDate>
    <dc:creator>lisabarelle</dc:creator>
    <dc:date>2022-01-12T14:07:42Z</dc:date>
    <item>
      <title>IF AND in a calculated field</title>
      <link>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880144#M1216815</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to create a new column in my table using the 'Calculated field'. It works fine with one condition ([RAG]), but when I try to use two other columns (i.e. two fields [RAG] and [CAUSE]) to create the output of the calculated filed, I don't get anything. I've tried the following, which doesn't work. Thoughts?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;[RAG]='Green',&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;'Green,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (([RAG]='Red') AND ([CAUSE]='Cancelled')),&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Cancelled',&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Red'&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 14:07:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880144#M1216815</guid>
      <dc:creator>lisabarelle</dc:creator>
      <dc:date>2022-01-12T14:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND in a calculated field</title>
      <link>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880160#M1216816</link>
      <description>&lt;P&gt;After the second Green add&amp;nbsp; '&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;LOAD&lt;BR /&gt;if(&lt;BR /&gt;[RAG]='Green',&lt;BR /&gt;'Green&lt;FONT size="6" color="#FF0000"&gt;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/FONT&gt;,&lt;BR /&gt;if(&lt;BR /&gt;(([RAG]='Red') AND ([CAUSE]='Cancelled')),&lt;/P&gt;
&lt;P&gt;'Cancelled',&lt;/P&gt;
&lt;P&gt;'Red'&lt;BR /&gt;)&lt;BR /&gt;) as NewField&lt;BR /&gt;,&lt;BR /&gt;*&lt;BR /&gt;;&lt;BR /&gt;LOAD * inline [&lt;BR /&gt;RAG, CAUSE&lt;BR /&gt;Red, -&lt;BR /&gt;Red, Cancelled&lt;BR /&gt;Green, -&lt;BR /&gt;Orange&lt;BR /&gt;];&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 14:21:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880160#M1216816</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2022-01-12T14:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND in a calculated field</title>
      <link>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880196#M1216818</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/14787"&gt;@maxgro&lt;/a&gt;&amp;nbsp;. Do I put this is the expression field of the calculated field? If so, it doesn't seem to work.&lt;/P&gt;
&lt;P&gt;Maybe if I better understand the syntax I can play around with it. What is the difference between LOAD and LOAD * inline? Do I need to hard code all of the combinations (I have more than the ones in this example)? And if so, do I need to do this every time I refresh my data?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 14:51:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880196#M1216818</guid>
      <dc:creator>lisabarelle</dc:creator>
      <dc:date>2022-01-12T14:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND in a calculated field</title>
      <link>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880254#M1216820</link>
      <description>&lt;P&gt;You said in a table, I assumed you meant in the script (load) part of Qlik (QikView or Qlik Sense).&lt;/P&gt;
&lt;P&gt;If instead you want to use in a &lt;STRONG&gt;chart&lt;/STRONG&gt; as a Calculated dimension, try&lt;/P&gt;
&lt;P&gt;if([RAG]='Green',&amp;nbsp;&amp;nbsp;'Green&lt;FONT size="6" color="#FF0000"&gt;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/FONT&gt;,&lt;BR /&gt;if((([RAG]='Red') AND ([CAUSE]='Cancelled')), 'Cancelled',&lt;/P&gt;
&lt;P&gt;'Red'))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Calculated dimension: if([RAG]='Green', ............&lt;/P&gt;
&lt;P&gt;Expression CAUSE, RAG&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maxgro_0-1642001813679.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/70085i1F0AF183603EB482/image-size/medium?v=v2&amp;amp;px=400" role="button" title="maxgro_0-1642001813679.png" alt="maxgro_0-1642001813679.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the expression (if.......) in the chart or in the script.&lt;/P&gt;
&lt;P&gt;In the script Qlik add a field to the table in the data model during the refresh of the data. The field is calculated and available to all the charts because the field is in the data model.&lt;/P&gt;
&lt;P&gt;In the chart&amp;nbsp;Qlik calculates the value on the fly when you analyze the data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding the load inline I often use load inline is a quick way to generate some data for test.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense/November2021/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularStatements/Load.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense/November2021/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularStatements/Load.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 15:59:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880254#M1216820</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2022-01-12T15:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: IF AND in a calculated field</title>
      <link>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880286#M1216821</link>
      <description>&lt;P&gt;Thanks a lot! Now I get it - I removed the LOAD * in line and fiddled around and it works. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 16:37:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-AND-in-a-calculated-field/m-p/1880286#M1216821</guid>
      <dc:creator>lisabarelle</dc:creator>
      <dc:date>2022-01-12T16:37:35Z</dc:date>
    </item>
  </channel>
</rss>

