<?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: Chart Expression with IF clause, fractile, and variable substitution in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1602429#M444431</link>
    <description>&lt;P&gt;I seriously didn't expect it to evaluate the second expression on a 'true' condition.&lt;/P&gt;&lt;P&gt;You're pretty slick. Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jul 2019 17:41:41 GMT</pubDate>
    <dc:creator>jwaligora</dc:creator>
    <dc:date>2019-07-15T17:41:41Z</dc:date>
    <item>
      <title>Chart Expression with IF clause, fractile, and variable substitution</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601094#M444286</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a vCalc variable that holds ONE of: {'Sum','Min','Max','Avg','Median','95th'}&lt;/P&gt;&lt;P&gt;Consequently, I have 2 expression scenarios:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;$(vCalc)(aggr(max([BBNOSSE.Time Spent]), [BBNOSSE.PKey]))&lt;/LI&gt;&lt;LI&gt;fractile(aggr(max([BBNOSSE.Time Spent]), [BBNOSSE.PKey]), 0.95)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;with the former corresponding to {'Sum','Min','Max','Avg','Median'} subset, and the latter to the {'95th'} value.&lt;/P&gt;&lt;P&gt;Each of these work just fine individually, but strange things happen when wrapped in an IF clause.&lt;/P&gt;&lt;P&gt;Works without issues:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= if (
	vCalc = '95th', 
	fractile(aggr(max([Time Spent]), [RecordID]), 0.95),
	10
  )&lt;/LI-CODE&gt;&lt;P&gt;Fails on (vCalc='95th') --&amp;gt; TRUE i.e. the 10;&amp;nbsp; (vCalc='95th') --&amp;gt; FALSE displays fine:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= if (
	vCalc = '95th', 
	10,
	$(vCalc)(aggr(max([Time Spent]), [RecordID]))
  )&lt;/LI-CODE&gt;&lt;P&gt;As above, fails on (vCalc='95th') --&amp;gt; TRUE i.e. the fractile;&amp;nbsp; (vCalc='95th') --&amp;gt; FALSE displays fine:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= if (
	vCalc = '95th', 
	fractile(aggr(max([Time Spent]), [RecordID]), 0.95),
	$(vCalc)(aggr(max([Time Spent]), [RecordID]))
  )&lt;/LI-CODE&gt;&lt;P&gt;(FAILS = "No data to display")&lt;/P&gt;&lt;P&gt;What obvious thing am I missing?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Joanna.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:02:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601094#M444286</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2024-11-16T03:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Chart Expression with IF clause, fractile, and variable substitution</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601128#M444293</link>
      <description>&lt;P&gt;Hi, I tested with:&amp;nbsp;=if (vCalc = '95th', 10, 20 )&lt;/P&gt;&lt;P&gt;If vCalc has the '95th' value it returns 10, if vCalc has any other value it returns 20.&lt;/P&gt;&lt;P&gt;can you confirm that the variable really stores 95th when it fails? maybe it has any additional character that make it go to the FALSE, creating an invalid expression.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 21:07:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601128#M444293</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2019-07-10T21:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Chart Expression with IF clause, fractile, and variable substitution</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601137#M444296</link>
      <description>&lt;P&gt;Hi. It definitely stores '95th', which is validated by the 1st code snippet.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 21:32:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601137#M444296</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2019-07-10T21:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Chart Expression with IF clause, fractile, and variable substitution</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601539#M444386</link>
      <description>&lt;P&gt;I fudged a fix by scrapping the IF clause and turning this into 2 completely separate expressions. The vCalc&amp;lt;&amp;gt;'95th' /&amp;nbsp; vCalc='95th' now lives in the "Conditional" section of Expressions tab. I still have no idea why the original approach keeps failing.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 18:55:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601539#M444386</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2019-07-11T18:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: Chart Expression with IF clause, fractile, and variable substitution</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601642#M444392</link>
      <description>&lt;P&gt;Hi, me neither, I can't reproduce the behaviour. If you can upload a sample I can take a look.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 06:09:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601642#M444392</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2019-07-12T06:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Chart Expression with IF clause, fractile, and variable substitution</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601905#M444403</link>
      <description>&lt;P&gt;See attached. Stripped down to bare bones.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Top graph uses the built-in condition (2 expressions). Works.&lt;/P&gt;&lt;P&gt;Bottom graph uses an&amp;nbsp; IF clause (1 expression). Works for only one of the 2 expressions.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 16:04:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1601905#M444403</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2019-07-12T16:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Chart Expression with IF clause, fractile, and variable substitution</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1602129#M444414</link>
      <description>&lt;P&gt;Ok, I did a simpler test, the problem is bacuase 95th causes an invalid 2nd expression, so all the expression turns invalid, you can try an approach like:&lt;/P&gt;&lt;P&gt;=if (&lt;BR /&gt;vCalc = '95th',&lt;BR /&gt;fractile(aggr(max([Time Spent]), [ID]), 0.95),&lt;BR /&gt;$(=Replace('$(vCalc)', '95th', 'Sum'))(aggr(max([Time Spent]), [ID]))&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the 2nd expression&amp;nbsp; uses Sum when 95th is selected. It won't be calculated as a sum, it's just to avoid the invalid syntax error.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 06:13:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1602129#M444414</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2019-07-15T06:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Chart Expression with IF clause, fractile, and variable substitution</title>
      <link>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1602429#M444431</link>
      <description>&lt;P&gt;I seriously didn't expect it to evaluate the second expression on a 'true' condition.&lt;/P&gt;&lt;P&gt;You're pretty slick. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 17:41:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Chart-Expression-with-IF-clause-fractile-and-variable/m-p/1602429#M444431</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2019-07-15T17:41:41Z</dc:date>
    </item>
  </channel>
</rss>

