<?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 Fields as variable in expressions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237354#M88411</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a transactions table that contains fields with keyfigures as gross sales, net sales, margin.&lt;/P&gt;&lt;P&gt;I would like to create a listbox where the analyser just has to select the keyfigure he wants to use in the charts.&lt;/P&gt;&lt;P&gt;The chart expressions would then contain the variable in stead of the field e.g. Sum(varKeyFigure) in stead of Sum(Gross_Sales)&lt;/P&gt;&lt;P&gt;How can I create this in the script?&lt;/P&gt;&lt;P&gt;Any help is appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Nov 2009 20:41:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-11-10T20:41:19Z</dc:date>
    <item>
      <title>Fields as variable in expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237354#M88411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a transactions table that contains fields with keyfigures as gross sales, net sales, margin.&lt;/P&gt;&lt;P&gt;I would like to create a listbox where the analyser just has to select the keyfigure he wants to use in the charts.&lt;/P&gt;&lt;P&gt;The chart expressions would then contain the variable in stead of the field e.g. Sum(varKeyFigure) in stead of Sum(Gross_Sales)&lt;/P&gt;&lt;P&gt;How can I create this in the script?&lt;/P&gt;&lt;P&gt;Any help is appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2009 20:41:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237354#M88411</guid>
      <dc:creator />
      <dc:date>2009-11-10T20:41:19Z</dc:date>
    </item>
    <item>
      <title>Fields as variable in expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237355#M88412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use variables in your expressions with a dollar sign expansion.&lt;/P&gt;&lt;P&gt;This should work:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum($(varKeyFigure))&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I would probably just Inline Load all of your Key Figures into a separate (unlinked) table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;LOAD * INLINE [&lt;BR /&gt; KeyFigures&lt;BR /&gt; Gross_Sales&lt;BR /&gt;];&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;And then set your variable value to:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;=ONLY(KeyFigures)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;That will work as long as one (and only one) selection is made in the key figures box. You can handle multiple selections or no selections as well, but that depends on the needs of the application.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2009 21:31:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237355#M88412</guid>
      <dc:creator />
      <dc:date>2009-11-10T21:31:16Z</dc:date>
    </item>
    <item>
      <title>Fields as variable in expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237356#M88413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Completely agree with NMiller, it is easier to maintain and no need for macro in this case.&lt;/P&gt;&lt;P&gt;Just don't forget to check &lt;STRONG&gt;always one Selected value&lt;/STRONG&gt; box for this field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2009 21:35:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237356#M88413</guid>
      <dc:creator />
      <dc:date>2009-11-10T21:35:23Z</dc:date>
    </item>
    <item>
      <title>Fields as variable in expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237357#M88414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gentlemen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This worked fine.&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2009 22:24:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237357#M88414</guid>
      <dc:creator />
      <dc:date>2009-11-10T22:24:46Z</dc:date>
    </item>
    <item>
      <title>Fields as variable in expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237358#M88415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm trying to do something very similiar, but need to include multiple fields, eg. Tonnes and Gross_Sales. I have a Field called KeyFigures with the list of relevant field names and have included that in the Chart as a Dimension.&lt;/P&gt;&lt;P&gt;I can use an Only(KeyFigures) function in the chart expression to return the field name, but can't get it to recognise that with in the Sum, ie. Sum(Only(KeyFigures)). I have tried various $ sign formats without success. It does work where only one KeyFigure is selected, but not multiple.&lt;/P&gt;&lt;P&gt;You suggested above that "can handle multiple selections or no selections as well", but not sure if I need to do something else to make it work.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 08:38:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Fields-as-variable-in-expressions/m-p/237358#M88415</guid>
      <dc:creator>michael_anthony</dc:creator>
      <dc:date>2009-12-10T08:38:14Z</dc:date>
    </item>
  </channel>
</rss>

