<?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: How to simplify this expression? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749832#M267508</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi DataNibbler,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maybe something like this (without your year-matching):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt; BudgetType = {"$(=if(match(getselectedcount(BudgetType), 0, 2), 'plant_#1', // as default&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; getfieldselections(BudgetType))"}&amp;gt;} BudgetValue)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Jan 2015 14:10:47 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2015-01-22T14:10:47Z</dc:date>
    <item>
      <title>How to simplify this expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749829#M267505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in my Management_Dashboard, I have a nr. of "traffic_lights" (gauge_charts that can take the values of 1=red, 5=yellow and 9=green)&lt;/P&gt;&lt;P&gt;=&amp;gt; For every KPI that I want to display the status of, I load the current figures, compare them to the budget which I have in a variable,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and thus I compute the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, however, I face the following challenge:&lt;/P&gt;&lt;P&gt;I have two separate budgets for the same KPI this year, one for the one plant and another for the second plant.&lt;/P&gt;&lt;P&gt;The user of this Management_Dashboard can either select one or the other plant or not select at all, in which case they would see the sum of the two budgets&lt;/P&gt;&lt;P&gt;=&amp;gt; The formula is such that the "used" part of the budget (say, we have a yearly budget) is compared to the part of the year that has&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; already passed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;gt; That makes for a formula with multiple nested IFs that will run over approx. one dozen lines or so since&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- I have to find out&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - whether the user has selected anything at all and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - which of the plants he has selected, if he has&lt;/P&gt;&lt;P&gt;=&amp;gt; Depending on that, the past part of the year will be compared to the spent part of&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - the budget for plant_#1 or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - the budget for plant_#2 or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - the sum of both&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody give me an idea of how to simplify this condition?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: Can I, like I can in any other type of diagram (say, in a straight_table), use one formula that I don't display to first calculate in a "side calculation" which budget is the relevant, based on the user's selections&lt;/P&gt;&lt;P&gt;and then just compare the used part of this to the past part of the month?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody g&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 13:06:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749829#M267505</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-01-22T13:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to simplify this expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749830#M267506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi DataNibbler,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would rather use set analysis instead nested if-loops and check inside with getfieldselection() and/or getselectedcount() which budget is chosen and maybe set a default-value for it if more as one value is selected or possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 13:17:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749830#M267506</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-01-22T13:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to simplify this expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749831#M267507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how would you use set_analysis in this scenario?&lt;/P&gt;&lt;P&gt;I have already found out that I cannot use a "side calculation" like I can do in other types of charts because in a circular gauge like I have it, there is no way of creating an expression with no graphical representation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: The formula in itself is not overly complicated - just a bit &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; I have constructed it already, and tested the individual elements in text_boxes and I know what should be the result, and it seems to be correct.&lt;/P&gt;&lt;P&gt;My only remaining problem is the one of defining which of the two budgets (or the sum of both) should be considered, which makes for approx. 3 additional lines in the formula - which I need twice as well since the formula (in pseudo-code) looks like this&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;- IF (used part of monthly budget)&amp;nbsp; &amp;lt;= (past part of the workdays of this month) =&amp;gt; then return the value 9&lt;/P&gt;&lt;P&gt;- IF(used part of monthly budget) &amp;lt;= (((past part of the workdays of this month) * 1.05) =&amp;gt; return the value 5&lt;/P&gt;&lt;P&gt;- otherwise return the value 1&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 13:45:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749831#M267507</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-01-22T13:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to simplify this expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749832#M267508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi DataNibbler,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maybe something like this (without your year-matching):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt; BudgetType = {"$(=if(match(getselectedcount(BudgetType), 0, 2), 'plant_#1', // as default&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; getfieldselections(BudgetType))"}&amp;gt;} BudgetValue)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 14:10:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749832#M267508</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-01-22T14:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to simplify this expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749833#M267509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ok - I've decided that I probably can't really make the formula any easier (the set_expression you propose won't make it much easier or shorter), so instead I decided to split it up - I now have an expression_variable that contains the expression needed to define which budget is relevant based on the user's selections.&lt;/P&gt;&lt;P&gt;I then plug that expression_variable into the formula itself which shrinks that to three lines, like it was before.&lt;/P&gt;&lt;P&gt;I guess I'll leave it at that - it will be different next year (at the latest, maybe earlier), so it's no use spending too much time on it now &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for helping anyway!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 14:17:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-simplify-this-expression/m-p/749833#M267509</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-01-22T14:17:42Z</dc:date>
    </item>
  </channel>
</rss>

