<?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 Variable in chart in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-in-chart/m-p/1582107#M739348</link>
    <description>&lt;P&gt;I have a variable that always equals a single number that I am trying to use in a bar chart as an expression. However, when using the variable, it only displays results when there is a selection.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable in question is a sum of many other variables which all have the same issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is an example of the flow of how I've done what I've done so far:&lt;/P&gt;&lt;P&gt;1. When a field is blank, if Hobbies is blank, give them 0 points, if there is data, then give them the value of 2.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;vHobbies&lt;/STRONG&gt; &lt;/U&gt;&lt;STRONG&gt;=&lt;/STRONG&gt;&amp;nbsp;if(Hobbies='' or IsNull(Hobbies),0,2)&lt;/P&gt;&lt;P&gt;2. There are then lots of these similar variables like above that are then added together to equal a new variable&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;vLifestyleRisk =&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;$(vHobbies) + $(vInterests) + $(vPartOfATeam) + $(vDrinker) + $(vReligion) + $(vSexuality) + $(vDietType) + $(vFavouriteSport) + $(vFavouriteTeam) + $(vVocalBeliefs)&lt;/P&gt;&lt;P&gt;3. This variable is then part of another sum which is the variable I am wanting to use in the bar chart:&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;vOverallRisk =&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;$(vPersonalRiskScore) +$(vFandFRiskScore) + $(vLifestyleRiskScore) + $(vWorkRiskScore)&lt;BR /&gt;+ $(vPersonalityRiskScore) + $(vExtrasRiskScore))&lt;/P&gt;&lt;P&gt;For some reason, the variables don't generate the numbers they are meant to generate. When I use the expression separately outside of the variable in a straight table, it works, but when inside the variable, it fails to give any result (see below).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hobbies 1.PNG" style="width: 705px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/12334i93095968872D83A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="hobbies 1.PNG" alt="hobbies 1.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hobbies 2.PNG" style="width: 710px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/12332i923E939C758CCDEC/image-size/large?v=v2&amp;amp;px=999" role="button" title="hobbies 2.PNG" alt="hobbies 2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this is why my variable isn't working in the bar chart but I have no idea why the variable wouldn't generate an amount when it works elsewhere as a normal expression. Why could this be?&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:32:06 GMT</pubDate>
    <dc:creator>khaycock</dc:creator>
    <dc:date>2024-11-16T03:32:06Z</dc:date>
    <item>
      <title>Variable in chart</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-chart/m-p/1582107#M739348</link>
      <description>&lt;P&gt;I have a variable that always equals a single number that I am trying to use in a bar chart as an expression. However, when using the variable, it only displays results when there is a selection.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable in question is a sum of many other variables which all have the same issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is an example of the flow of how I've done what I've done so far:&lt;/P&gt;&lt;P&gt;1. When a field is blank, if Hobbies is blank, give them 0 points, if there is data, then give them the value of 2.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;vHobbies&lt;/STRONG&gt; &lt;/U&gt;&lt;STRONG&gt;=&lt;/STRONG&gt;&amp;nbsp;if(Hobbies='' or IsNull(Hobbies),0,2)&lt;/P&gt;&lt;P&gt;2. There are then lots of these similar variables like above that are then added together to equal a new variable&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;vLifestyleRisk =&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;$(vHobbies) + $(vInterests) + $(vPartOfATeam) + $(vDrinker) + $(vReligion) + $(vSexuality) + $(vDietType) + $(vFavouriteSport) + $(vFavouriteTeam) + $(vVocalBeliefs)&lt;/P&gt;&lt;P&gt;3. This variable is then part of another sum which is the variable I am wanting to use in the bar chart:&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;vOverallRisk =&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;$(vPersonalRiskScore) +$(vFandFRiskScore) + $(vLifestyleRiskScore) + $(vWorkRiskScore)&lt;BR /&gt;+ $(vPersonalityRiskScore) + $(vExtrasRiskScore))&lt;/P&gt;&lt;P&gt;For some reason, the variables don't generate the numbers they are meant to generate. When I use the expression separately outside of the variable in a straight table, it works, but when inside the variable, it fails to give any result (see below).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hobbies 1.PNG" style="width: 705px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/12334i93095968872D83A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="hobbies 1.PNG" alt="hobbies 1.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hobbies 2.PNG" style="width: 710px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/12332i923E939C758CCDEC/image-size/large?v=v2&amp;amp;px=999" role="button" title="hobbies 2.PNG" alt="hobbies 2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this is why my variable isn't working in the bar chart but I have no idea why the variable wouldn't generate an amount when it works elsewhere as a normal expression. Why could this be?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:32:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-chart/m-p/1582107#M739348</guid>
      <dc:creator>khaycock</dc:creator>
      <dc:date>2024-11-16T03:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in chart</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-chart/m-p/1582118#M739349</link>
      <description>Hello there,&lt;BR /&gt;&lt;BR /&gt;1)&lt;BR /&gt;for the last two variables try to define them like this&lt;BR /&gt;vLifestyleRisk = Rangesum($(vHobbies), $(vInterests),$(vPartOfATeam), $(vDrinker) ..)&lt;BR /&gt;&lt;BR /&gt;2) to go save you have number just wrap num( ) around your first variables&lt;BR /&gt;&lt;BR /&gt;3) maybe you want to replace&lt;BR /&gt;if(Hobbies='' or IsNull(Hobbies),0,2)&lt;BR /&gt;with&lt;BR /&gt;if(len(trim(Hobbies))&amp;gt;0, 0, 2)&lt;BR /&gt;-&amp;gt; this will also catch field blanks</description>
      <pubDate>Mon, 20 May 2019 11:08:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-chart/m-p/1582118#M739349</guid>
      <dc:creator>zhadrakas</dc:creator>
      <dc:date>2019-05-20T11:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in chart</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-chart/m-p/1582171#M739350</link>
      <description>&lt;P&gt;I think it's been caused through &lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-Little-Equals-Sign/ba-p/1475639" target="_self"&gt;The-Little-Equals-Sign&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 12:05:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-chart/m-p/1582171#M739350</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-05-20T12:05:39Z</dc:date>
    </item>
  </channel>
</rss>

