<?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 What is the syntax of a variable, to use it in an expression ? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/What-is-the-syntax-of-a-variable-to-use-it-in-an-expression/m-p/1566053#M43914</link>
    <description>&lt;P&gt;Hi the community !&lt;/P&gt;&lt;P&gt;I would like to shorten this expression to use it in set analysis :&lt;/P&gt;&lt;PRE&gt;sum(({&amp;lt;Indicateur = {'Pages Vues en Total'}&amp;gt;} Valeur)/1000000)&lt;/PRE&gt;&lt;P&gt;i will need to use 'Pages Vues en Total' (=pages views)&amp;nbsp; &amp;nbsp;in Sum or Avg.&lt;/P&gt;&lt;P&gt;i tried to create a VARIABLE&amp;nbsp; &amp;nbsp;" Var.PV" =&lt;/P&gt;&lt;PRE&gt;({&amp;lt;Indicateur = {'Pages Vues en Total'}&amp;gt;} Valeur)/1000000&lt;/PRE&gt;&lt;P&gt;I do not manage to use ot in the expression as&lt;/P&gt;&lt;PRE&gt;sum(Var.PV)&lt;/PRE&gt;&lt;P&gt;Then, i will have to use this VARIABLE in that kind of expression, to compare it VS previous month :&lt;/P&gt;&lt;PRE&gt;(
sum( {&amp;lt;Mois = {$(=num(Max (Mois),'00'))}&amp;gt;} [VARIABLE])-sum( {&amp;lt;Année = {$(=num(  if(max(Mois)=1, Max (Année)-1,Max (Année))  ,'00'))},  Mois = {$(=num( if(max(Mois)=1, 12, max(Mois)-1) ,'00'))}&amp;gt;}  [VARIABLE])
)
/sum( {&amp;lt;Année =  {$(=num(  if(max(Mois)=1, Max (Année)-1,Max (Année))  ,'00'))},   Mois = {$(=num(if(Max (Mois)=1,12,max(Mois)-1),'00'))}&amp;gt;} [VARIABLE])&lt;/PRE&gt;&lt;P&gt;Any idea of the syntax ?&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 06:08:11 GMT</pubDate>
    <dc:creator>marieclaire</dc:creator>
    <dc:date>2024-11-16T06:08:11Z</dc:date>
    <item>
      <title>What is the syntax of a variable, to use it in an expression ?</title>
      <link>https://community.qlik.com/t5/App-Development/What-is-the-syntax-of-a-variable-to-use-it-in-an-expression/m-p/1566053#M43914</link>
      <description>&lt;P&gt;Hi the community !&lt;/P&gt;&lt;P&gt;I would like to shorten this expression to use it in set analysis :&lt;/P&gt;&lt;PRE&gt;sum(({&amp;lt;Indicateur = {'Pages Vues en Total'}&amp;gt;} Valeur)/1000000)&lt;/PRE&gt;&lt;P&gt;i will need to use 'Pages Vues en Total' (=pages views)&amp;nbsp; &amp;nbsp;in Sum or Avg.&lt;/P&gt;&lt;P&gt;i tried to create a VARIABLE&amp;nbsp; &amp;nbsp;" Var.PV" =&lt;/P&gt;&lt;PRE&gt;({&amp;lt;Indicateur = {'Pages Vues en Total'}&amp;gt;} Valeur)/1000000&lt;/PRE&gt;&lt;P&gt;I do not manage to use ot in the expression as&lt;/P&gt;&lt;PRE&gt;sum(Var.PV)&lt;/PRE&gt;&lt;P&gt;Then, i will have to use this VARIABLE in that kind of expression, to compare it VS previous month :&lt;/P&gt;&lt;PRE&gt;(
sum( {&amp;lt;Mois = {$(=num(Max (Mois),'00'))}&amp;gt;} [VARIABLE])-sum( {&amp;lt;Année = {$(=num(  if(max(Mois)=1, Max (Année)-1,Max (Année))  ,'00'))},  Mois = {$(=num( if(max(Mois)=1, 12, max(Mois)-1) ,'00'))}&amp;gt;}  [VARIABLE])
)
/sum( {&amp;lt;Année =  {$(=num(  if(max(Mois)=1, Max (Année)-1,Max (Année))  ,'00'))},   Mois = {$(=num(if(Max (Mois)=1,12,max(Mois)-1),'00'))}&amp;gt;} [VARIABLE])&lt;/PRE&gt;&lt;P&gt;Any idea of the syntax ?&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 06:08:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/What-is-the-syntax-of-a-variable-to-use-it-in-an-expression/m-p/1566053#M43914</guid>
      <dc:creator>marieclaire</dc:creator>
      <dc:date>2024-11-16T06:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: What is the syntax of a variable, to use it in an expression ?</title>
      <link>https://community.qlik.com/t5/App-Development/What-is-the-syntax-of-a-variable-to-use-it-in-an-expression/m-p/1566064#M43915</link>
      <description>The syntax to use a variable is $(), so:&lt;BR /&gt;&lt;BR /&gt;sum($(Var.PV))&lt;BR /&gt;&lt;BR /&gt;When you use a variable in this way the content of the variable is effectively copied and pasted into the location where the $() appears.&lt;BR /&gt;&lt;BR /&gt;Note that behaviour is different if your variable content begins with an equals symbol, as in this case the variable code is evaluated outside of the object where it is used and the result is returned.&lt;BR /&gt;&lt;BR /&gt;$(=some(expression)) effectively calculates the expression outside of the context where the variable is used also.&lt;BR /&gt;&lt;BR /&gt;Hope that makes sense?&lt;BR /&gt;&lt;BR /&gt;Instinctively, I have never put a period in any of my variable names, but I see no reason why it shouldn't work. If it doesn't maybe try just VarPV.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Sat, 06 Apr 2019 20:58:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/What-is-the-syntax-of-a-variable-to-use-it-in-an-expression/m-p/1566064#M43915</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2019-04-06T20:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: What is the syntax of a variable, to use it in an expression ?</title>
      <link>https://community.qlik.com/t5/App-Development/What-is-the-syntax-of-a-variable-to-use-it-in-an-expression/m-p/1566154#M43916</link>
      <description>&lt;P&gt;Thank you Steve for your time.&lt;/P&gt;&lt;P&gt;But it does not work.&lt;/P&gt;&lt;P&gt;These are the variable and the expression :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="variable.PNG" style="width: 663px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/9655i62B085FD569FE796/image-size/large?v=v2&amp;amp;px=999" role="button" title="variable.PNG" alt="variable.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;sum($(var.PV))&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Apr 2019 20:57:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/What-is-the-syntax-of-a-variable-to-use-it-in-an-expression/m-p/1566154#M43916</guid>
      <dc:creator>marieclaire</dc:creator>
      <dc:date>2019-04-07T20:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: What is the syntax of a variable, to use it in an expression ?</title>
      <link>https://community.qlik.com/t5/App-Development/What-is-the-syntax-of-a-variable-to-use-it-in-an-expression/m-p/1566230#M43917</link>
      <description>&lt;P&gt;You need to remove the two brackets from within the variable, or from where you are using it.&lt;/P&gt;&lt;P&gt;When the variable is copied and pasted (effectively) into your code you get:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(&lt;FONT color="#0000FF"&gt;({&amp;lt;Indicateur={'Pages Vues en Total'}&amp;gt;}Valuer)/1000000&lt;/FONT&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Because of the double bracket at the start, the Set Analysis code is not part of the sum, rather in a bracketed set of code by itself, and set analysis doesn't work like that.&lt;/P&gt;&lt;P&gt;Hope that makes sense?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 07:48:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/What-is-the-syntax-of-a-variable-to-use-it-in-an-expression/m-p/1566230#M43917</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2019-04-08T07:48:40Z</dc:date>
    </item>
  </channel>
</rss>

