<?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: Put the formula from field into dollar sign expansion - and calculate it in expression of a chart in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000027#M340000</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Do you mind to try this in script level? Like&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[KPI formulas]:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load KPI,Formula,Evaluate(Formula) as New;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KPI, Formula&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KPI1, 10/3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KPI2, 30/4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 31 Oct 2015 17:25:17 GMT</pubDate>
    <dc:creator>settu_periasamy</dc:creator>
    <dc:date>2015-10-31T17:25:17Z</dc:date>
    <item>
      <title>Put the formula from field into dollar sign expansion - and calculate it in expression of a chart</title>
      <link>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000025#M339998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear QV Fellows:&lt;/P&gt;&lt;P&gt;Probably found another thing QV is unable to do. &lt;A _jive_internal="true" href="https://community.qlik.com/message/748494#748494"&gt;Here is a similar problem&lt;/A&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you ever dealt with the formulas that you fed into Expression from a [metadata] table and dynamically calculated them depending on the dimensions? Below the detail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;We have this problem:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;0. I am trying to implement a robust data structure, where &lt;SPAN style="text-decoration: underline;"&gt;it's possible to define formulas in a table and then use them dynamically in the same expression of a pivot&lt;/SPAN&gt;. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I know if you put a formula in dollar sign expansion, it will get evaluated. So I need to evaluate all the formulas at the same time.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1. The table below is a dummy table that illustrates my need. Column [Formula] contains the formula to evaluate the particular KPI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Of course the real formulas will be like SUM(Col) etc., but now simple expressions are enough to showcase the point.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[KPI formulas]:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KPI ID, Formula&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KPI1, 10/3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KPI2, 30/4&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now I need to have a pivot that will act as follows:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="74" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" style="border: 1px solid #000000; width: 494px; height: 68px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;KPI ID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Value&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; color: #000000; padding: 2px; background-color: #ffff00;" valign="middle"&gt;&lt;STRONG&gt;Explanation&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;KPI1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3.333&lt;/TD&gt;&lt;TD style="padding: 2px; background-color: #ffff00;"&gt;it evaluated the contents of Formula column, which is 10/3 = 3.333&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;KPI2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;7.5&lt;/TD&gt;&lt;TD style="padding: 2px; background-color: #ffff00;"&gt;ditto, 30/4 = 7.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I start building this:&lt;/P&gt;&lt;P&gt;1. If I put &lt;STRONG&gt;=Formula&lt;/STRONG&gt; in expressions&lt;SPAN style="font-size: 13.3333px;"&gt;, it outputs the content of the field as I expect&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2015-10-30_135649.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/103582_2015-10-30_135649.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;2. If I put &lt;STRONG&gt;=only(Formula)&lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; in expressions&lt;/SPAN&gt;, it also outputs the content of the field:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2015-10-30_140041.png" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/103595_2015-10-30_140041.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Ok, then we are ready for some dollar-sign expansion. And it &lt;STRONG style="font-size: 14pt;"&gt;does not work&lt;/STRONG&gt;!&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2015-10-30_140440.png" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/103596_2015-10-30_140440.png" style="height: 79px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Ok, how about putting the ref to formula in a variable and instead calculate the variable.&lt;/P&gt;&lt;P&gt;So I create variable vDynamicFormula and set it to "&lt;STRONG&gt;only(Formula)&lt;/STRONG&gt;". Now trying to make use of it in the pivot. &lt;SPAN style="font-size: 14pt;"&gt;&lt;STRONG&gt;Not working&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2015-10-30_141507.png" class="image-4 jive-image" src="https://community.qlik.com/legacyfs/online/103602_2015-10-30_141507.png" style="height: 112px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I &lt;STRONG&gt;only select 1 KPI&lt;/STRONG&gt;, it gives me the expected result, though:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2015-10-30_142607.png" class="image-5 jive-image" src="https://community.qlik.com/legacyfs/online/103603_2015-10-30_142607.png" style="height: 72px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;But this is not accomplishing the goal.&lt;/P&gt;&lt;P&gt;ALL KPIs need to be calculated and displayed at the same time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok, many people told me that the dollar sign expansions expand only once per chart. Which means: if you have more variants of the contents of dollar sign expansion, you won't get anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;STRONG&gt;Possible solution&lt;/STRONG&gt;: multi-level IF statement. It works, but imagine 30 nested IFs if you have 30 KPIs. This is not beautiful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QVD attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Oct 2015 13:37:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000025#M339998</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-30T13:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Put the formula from field into dollar sign expansion - and calculate it in expression of a chart</title>
      <link>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000026#M339999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Possible workaround is with pick, which is feasible and works: &lt;A href="https://community.qlik.com/message/400265"&gt;Using formulas from excel in the straight table&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Oct 2015 15:56:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000026#M339999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-31T15:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Put the formula from field into dollar sign expansion - and calculate it in expression of a chart</title>
      <link>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000027#M340000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Do you mind to try this in script level? Like&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[KPI formulas]:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load KPI,Formula,Evaluate(Formula) as New;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KPI, Formula&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KPI1, 10/3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KPI2, 30/4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Oct 2015 17:25:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000027#M340000</guid>
      <dc:creator>settu_periasamy</dc:creator>
      <dc:date>2015-10-31T17:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Put the formula from field into dollar sign expansion - and calculate it in expression of a chart</title>
      <link>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000028#M340001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can find in the attached QVW 2 solutions :&lt;/P&gt;&lt;P&gt;(expression only. &lt;SPAN style="font-size: 13.3333px;"&gt;For both solutions we added in the script a self-generated Id, to keep it simple.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- the first one uses pick , as suggested also by yourself, Igor&lt;/P&gt;&lt;P&gt;We've used this solution in production for a while with auto-generated (in the script) veeeery long crazy formulas, but the interface performance is poor.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;=pick(Id,$(=concat(distinct all Formula,',')))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- the second one adds the evaluations that is valid for each situations. We did some tests for changing the first (pick) solution and it seems to be far better in performance, even though the script to generate will become a little bit more complicated&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =sum({&amp;lt;Id={1}&amp;gt;} $(=only({&amp;lt;Id={1}&amp;gt;} Formula)))+sum({&amp;lt;Id={2}&amp;gt;} $(=only({&amp;lt;Id={2}&amp;gt;} Formula)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will notice that activating a selection is generating different behaviour with these solutions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Nov 2015 07:52:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000028#M340001</guid>
      <dc:creator>cotiso_hanganu</dc:creator>
      <dc:date>2015-11-01T07:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Put the formula from field into dollar sign expansion - and calculate it in expression of a chart</title>
      <link>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000029#M340002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Cotiso. The set analysis approach does exactly what I expect!&lt;/P&gt;&lt;P&gt;Also agreed that it performs faster. From my experience, Set Analysis is preferred over IF or PICK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The workflow will be as follows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Load the KPI formula table&lt;/LI&gt;&lt;LI&gt;Loop through the KPI formula table to get all 30 KPIs into a variable in the Set Analysis format that you suggested (there is a code snippet here that I will use: &lt;A href="https://community.qlik.com/message/400265"&gt;Using formulas from excel in the straight table&lt;/A&gt;)&lt;/LI&gt;&lt;LI&gt;Use the variable in the chart&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, much appreciated!&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Nov 2015 10:44:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Put-the-formula-from-field-into-dollar-sign-expansion-and/m-p/1000029#M340002</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-01T10:44:08Z</dc:date>
    </item>
  </channel>
</rss>

