<?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: Using IF with a variable in expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128502#M756789</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;what is the content of the variable ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Sep 2018 12:39:59 GMT</pubDate>
    <dc:creator>YoussefBelloum</dc:creator>
    <dc:date>2018-09-14T12:39:59Z</dc:date>
    <item>
      <title>Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128501#M756788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use an if statement with a variable in my expression and I get no results. The variable works when I use the variable on it's own but when used with the if I get no results.&lt;/P&gt;&lt;P&gt;I have tried:&lt;/P&gt;&lt;P&gt;if(OrderQtr='Apr-Jun 2018',$(vAvgOrderCost),0)&lt;/P&gt;&lt;P&gt;if(OrderQtr='Apr-Jun 2018',sum($(vAvgOrderCost)),0)&lt;/P&gt;&lt;P&gt;sum(&lt;SPAN style="color: #575757; font-family: arial,helvetica,sans-serif; font-size: 13.33px; font-style: normal; font-weight: 400; text-align: left; text-indent: 0px;"&gt;$(vAvgOrderCost)&lt;/SPAN&gt;if(OrderQtr='Apr-Jun 2018',0))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nothing seems to work. Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128501#M756788</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128502#M756789</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;what is the content of the variable ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 12:39:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128502#M756789</guid>
      <dc:creator>YoussefBelloum</dc:creator>
      <dc:date>2018-09-14T12:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128503#M756790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, and also.."&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;EM&gt;if(OrderQtr='Apr-Jun 2018',&lt;STRONG&gt;1&lt;/STRONG&gt;,0)&lt;/EM&gt;" returns '1' in the expected quarter?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 12:43:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128503#M756790</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2018-09-14T12:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128504#M756791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The variable content is =Sum([Unit Cost PO])/Count([Unit Cost PO])&lt;/P&gt;&lt;P&gt;Also&amp;nbsp; &lt;SPAN style="color: #3d3d3d;"&gt;&lt;EM&gt;if(OrderQtr='Apr-Jun 2018',&lt;/EM&gt;&lt;STRONG style="font-family: &amp;amp;font-size:13px; font-style: italic; font-weight: bold; border-color: #3d3d3d; border-style: none;"&gt;1&lt;/STRONG&gt;&lt;EM&gt;,0)&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;" did not return 1 in the expected quarter&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:39:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128504#M756791</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2018-09-14T13:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128505#M756792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;The variable content is =Sum([Unit Cost PO])/Count([Unit Cost PO])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Thanks&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:40:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128505#M756792</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2018-09-14T13:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128506#M756793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is the column type of OrderQtr. that maybe the issue there&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:41:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128506#M756793</guid>
      <dc:creator>dplr-rn</dc:creator>
      <dc:date>2018-09-14T13:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128507#M756794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Money&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:48:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128507#M756794</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2018-09-14T13:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128508#M756795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure why OrderQuarter is money but try converting it to string before doing the compare&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:51:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128508#M756795</guid>
      <dc:creator>dplr-rn</dc:creator>
      <dc:date>2018-09-14T13:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128509#M756796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try to remove the = sign on the variable and see if the expressions works&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:57:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128509#M756796</guid>
      <dc:creator>YoussefBelloum</dc:creator>
      <dc:date>2018-09-14T13:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128510#M756797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sorry OrderQtr is not money. It is text. The result of the expression is money.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 14:02:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128510#M756797</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2018-09-14T14:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128511#M756798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did. Didn't work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 14:05:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128511#M756798</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2018-09-14T14:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128512#M756799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ade, then your main problem is the comparison, "Apr-Jun 2018" seems created as quartername, maybe with:&lt;/P&gt;&lt;P&gt;If(quartername(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;OrderQtr)='Apr-Jun 2018',$(vAvgOrderCost),0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Or try showing OrderQtr in an expression to check the value, then copy and paste in the expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; 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; font-size: 13px;"&gt;Another option is using a number field to avoid formatting issues:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Num(QuarterStart(OrderQtr)) as NumOrderQtr // in script&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;if(NumOrderQtr=43191,$(vAvgOrderCost),0) // 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; font-size: 13px;"&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; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&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; font-size: 13px;"&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; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Sep 2018 10:21:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128512#M756799</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2018-09-15T10:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128513#M756800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;I tried the first suggestion and it didn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added the second suggestion in the script and it blew loading. I think it's because it didn't find the field OrderQtr. This field is derived in my preceding lines in the script. Here is my script with your suggestion added&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;OrderDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week(OrderDate) as OrderWeek,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month (OrderDate) as OrderMonth,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year (OrderDate) as OrderYear, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QuarterName(OrderDate,0,1) as OrderQtr,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(QuarterStart(OrderQtr)) as NumOrderQtr (Yours)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 15:39:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128513#M756800</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2018-09-17T15:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128514#M756801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ade, in that case you should use OrderDate:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; Num(QuarterStart(OrderDate)) as NumOrderQtr&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 15:43:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128514#M756801</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2018-09-17T15:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128515#M756802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Loaded but still getting $0 in the expression result&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 15:51:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128515#M756802</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2018-09-17T15:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128516#M756803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you upload a sample to check? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 16:14:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128516#M756803</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2018-09-17T16:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128517#M756804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I replied to your e-mail with the file attached. I didn't know a way to upload here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 18:54:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128517#M756804</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2018-09-17T18:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128518#M756805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ade, the document didn't reached my email, to upload a file use advanced editor:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="captura.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/213778_captura.jpg" style="height: 53px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below you have the option to attach:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="captura.jpg" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/213788_captura.jpg" style="height: 71px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create a new document with dummy data to show the problem (just to not upload real data) &lt;SPAN style="font-size: 13.3333px;"&gt;or use File -&amp;gt; Reduce Data -&amp;gt; Keep Possible Values to reduce the data uploaded.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2018 06:53:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128518#M756805</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2018-09-18T06:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128519#M756806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here you go&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2018 14:23:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128519#M756806</guid>
      <dc:creator>ashokunbi</dc:creator>
      <dc:date>2018-09-18T14:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using IF with a variable in expression</title>
      <link>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128520#M756807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see whats happening, &lt;STRONG&gt;you don't have a dimensión, so the if()&lt;/STRONG&gt; &lt;STRONG&gt;always returns null() because each row has all quarternumbers&lt;/STRONG&gt;,&lt;STRONG&gt; &lt;/STRONG&gt;usually to add filters other than dimensions you need to use set analysis, wich will broke the use you are doing of variables, or you will need to pass the quarter as parameter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One quick fix can be adding an aggr to the expression, so each row will virtually check the quarters one by one:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(&lt;/STRONG&gt;if(NumOrderQtr=43191,$(vAvgOrderCost),0), &lt;STRONG&gt;NumOrderQtr))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2018 14:31:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-IF-with-a-variable-in-expression/m-p/128520#M756807</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2018-09-18T14:31:19Z</dc:date>
    </item>
  </channel>
</rss>

