<?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 Help with variables and greater than in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552004#M1145161</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="p1"&gt;Hi,&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;I'm slowly grasping how variables work, but am having a bit of trouble with the syntax.&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;I'm trying to count a distinct number of [Billing code]'s where the current year is 2013, the status not equal to Admin and there's some cost booked against it ([Hours Worked * Rate).&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;The year and status work fine, but I'm not able to format the calculation for hours as I'm&lt;SPAN style="font-size: 10pt;"&gt; trying to calculate a range, i.e where the cost is between £1000 and £4999, £5000 - £9999, etc.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;=&lt;SPAN class="s1"&gt;Count&lt;/SPAN&gt;(&lt;SPAN class="s1"&gt;DISTINCT&lt;/SPAN&gt; {&amp;lt; &lt;SPAN class="s2"&gt;[Year]&lt;/SPAN&gt;={&lt;SPAN class="s3"&gt;&lt;EM&gt;$(vCurrentYear)&lt;/EM&gt;&lt;/SPAN&gt;}, &lt;SPAN class="s2"&gt;[Project Status]&lt;/SPAN&gt;-={'Admin'}, &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;(&lt;SPAN class="s2"&gt;[Hours Worked]&lt;/SPAN&gt; *if(IsNull(Rate), 20, Rate)) &amp;lt;1000 &lt;/STRONG&gt;&lt;/SPAN&gt;&amp;gt;} &lt;SPAN class="s2"&gt;[Billing code]&lt;/SPAN&gt;) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Aug 2013 08:40:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-08-02T08:40:49Z</dc:date>
    <item>
      <title>Help with variables and greater than</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552004#M1145161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="p1"&gt;Hi,&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;I'm slowly grasping how variables work, but am having a bit of trouble with the syntax.&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;I'm trying to count a distinct number of [Billing code]'s where the current year is 2013, the status not equal to Admin and there's some cost booked against it ([Hours Worked * Rate).&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;The year and status work fine, but I'm not able to format the calculation for hours as I'm&lt;SPAN style="font-size: 10pt;"&gt; trying to calculate a range, i.e where the cost is between £1000 and £4999, £5000 - £9999, etc.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;=&lt;SPAN class="s1"&gt;Count&lt;/SPAN&gt;(&lt;SPAN class="s1"&gt;DISTINCT&lt;/SPAN&gt; {&amp;lt; &lt;SPAN class="s2"&gt;[Year]&lt;/SPAN&gt;={&lt;SPAN class="s3"&gt;&lt;EM&gt;$(vCurrentYear)&lt;/EM&gt;&lt;/SPAN&gt;}, &lt;SPAN class="s2"&gt;[Project Status]&lt;/SPAN&gt;-={'Admin'}, &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;(&lt;SPAN class="s2"&gt;[Hours Worked]&lt;/SPAN&gt; *if(IsNull(Rate), 20, Rate)) &amp;lt;1000 &lt;/STRONG&gt;&lt;/SPAN&gt;&amp;gt;} &lt;SPAN class="s2"&gt;[Billing code]&lt;/SPAN&gt;) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 08:40:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552004#M1145161</guid>
      <dc:creator />
      <dc:date>2013-08-02T08:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help with variables and greater than</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552005#M1145162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would calculate the cost in the script ( &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;(&lt;SPAN class="s2"&gt;[Hours Worked]&lt;/SPAN&gt; *if(IsNull(Rate), 20, Rate)) &lt;/STRONG&gt;&lt;/SPAN&gt;) as TotalCost, so you can refer to this field in the Set Analysis. Alternative calculate it in a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your new function would then look something like&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;=&lt;SPAN class="s1"&gt;Count&lt;/SPAN&gt;(&lt;SPAN class="s1"&gt;DISTINCT&lt;/SPAN&gt; {&amp;lt; &lt;SPAN class="s2"&gt;[Year]&lt;/SPAN&gt;={&lt;SPAN class="s3"&gt;&lt;EM&gt;$(vCurrentYear)&lt;/EM&gt;&lt;/SPAN&gt;}, &lt;SPAN class="s2"&gt;[Project Status]&lt;/SPAN&gt;-={'Admin'}, &lt;SPAN style="color: black; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: DA; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;TotalCost={&lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: DA; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;"&amp;gt;=1000&amp;lt;=5000"} &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&amp;gt;} &lt;SPAN class="s2"&gt;[Billing code]&lt;/SPAN&gt;) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 09:30:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552005#M1145162</guid>
      <dc:creator>jfkinspari</dc:creator>
      <dc:date>2013-08-02T09:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Help with variables and greater than</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552006#M1145163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. Yep, that makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried adding it as a variable (as that's something I think I can do)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Created a variable called vTotalCost, with the following formula&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; color: #ff0000; font-family: Arial;"&gt;&lt;SPAN class="s2"&gt;[Hours Worked]&lt;/SPAN&gt; *if(IsNull(Rate), 20, Rate)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then added the following in to the text object:&lt;/P&gt;&lt;P class="p1"&gt;=Count(DISTINCT {&amp;lt; [Year]={$(vCurrentYear)}, [Project Status]-={'Admin'}, $(vTotalCost)={"&amp;gt;=1000&amp;lt;=5000"} &amp;gt;} [Billing code])&lt;/P&gt;&lt;P class="p1"&gt;I also tried&lt;/P&gt;&lt;P class="p1"&gt;=Count(DISTINCT {&amp;lt; [Year]={$(vCurrentYear)}, [Project Status]-={'Admin'}, $(vTotalCost)={&lt;STRONG&gt;'&lt;/STRONG&gt;&amp;gt;=1000&amp;lt;=5000&lt;STRONG&gt;'&lt;/STRONG&gt;} &amp;gt;} [Billing code])&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;replacing the "s with 's, but neither worked, I get '-' as a result.&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;Any ideas what I might be doing wrong?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 09:46:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552006#M1145163</guid>
      <dc:creator />
      <dc:date>2013-08-02T09:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with variables and greater than</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552007#M1145164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect this might be related to the granularity of the data used in the variable. Is Hours Worked and Rate on the same level?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try and make a straight table, where you display the result of the variable. If you can't make it display a number, you might need to add a sum() to variable, but it depends on the datastructure&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000; font-family: Arial; background-color: #ffffff;"&gt;&lt;SPAN class="s2"&gt;sum( [Hours Worked]&lt;/SPAN&gt; *if(IsNull(Rate), 20, Rate) )&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 10:35:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552007#M1145164</guid>
      <dc:creator>jfkinspari</dc:creator>
      <dc:date>2013-08-02T10:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help with variables and greater than</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552008#M1145166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, looks like it's a problem in the level. The variable returns '-' in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Going to need to work out another way to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 10:48:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-variables-and-greater-than/m-p/552008#M1145166</guid>
      <dc:creator />
      <dc:date>2013-08-02T10:48:30Z</dc:date>
    </item>
  </channel>
</rss>

