<?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: Pick function not working in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617618#M45973</link>
    <description>&lt;P&gt;Can you try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pick(
    Only({1} TOTAL &amp;lt;Heading&amp;gt; [Sort]),
    Sum({1&amp;lt;[Year Month Date]={'$(vMaxYearMonthDate)'}&amp;gt;} Sales),
    Sum({1&amp;lt;[Year Month Date]={"&amp;lt;=$(vMaxYearMonthDate)"}&amp;gt;} Sales)
)&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 28 Aug 2019 12:40:04 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-08-28T12:40:04Z</dc:date>
    <item>
      <title>Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1612810#M45619</link>
      <description>&lt;P&gt;This question is in relation to the following example qlik sense model: &lt;A href="https://www.dropbox.com/s/vvm1m6jlm77ues1/YTD%20incomplete%20timeline.qvf?dl=0" target="_blank" rel="noopener"&gt;https://www.dropbox.com/s/vvm1m6jlm77ues1/YTD%20incomplete%20timeline.qvf?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have an expression which calculates a current month or YTD value based on a field in a data island.&lt;/P&gt;&lt;P&gt;If I make a selection on the [Financial Period] field and there is no data rows for item A for that specific financial period, then the YTD total isn't calculated on the item A row. The Grand Total however still calculates correctly.&lt;/P&gt;&lt;P&gt;Why is that?&lt;/P&gt;&lt;P&gt;The expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pick(
	[Sort],
    Sum({&amp;lt;[Financial Period]={'$(vCurrentFinancialPeriod)'}&amp;gt;} Sales),
    Sum({&amp;lt;[Financial Period]={"&amp;lt;=$(vCurrentFinancialPeriod)"}&amp;gt;} Sales)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2019-08-15 125140.png" style="width: 663px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17090i39909CA18BB661D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-08-15 125140.png" alt="Annotation 2019-08-15 125140.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="No selections" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17091i28FB36AF845A34FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-08-15 125421.png" alt="No selections" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;No selections&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Selection where item A doesn't have data in the specific financial period. Note that A shows as null in the YTD column calc, while the grand total is correct." style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17092i55AE49F05AEB6B0B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-08-15 125342.png" alt="Selection where item A doesn't have data in the specific financial period. Note that A shows as null in the YTD column calc, while the grand total is correct." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Selection where item A doesn't have data in the specific financial period. Note that A shows as null in the YTD column calc, while the grand total is correct.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 10:58:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1612810#M45619</guid>
      <dc:creator>MynhardtBurger</dc:creator>
      <dc:date>2019-08-15T10:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1612956#M45626</link>
      <description>&lt;P&gt;The comparison against your variable is different in your expression - the first compares on a string-level and the second is a numeric one. Further it's not clear if your date-fields contain really a date or maybe a timestamp. Both things may lead to unexpected results if you are unaware about it.&lt;/P&gt;&lt;P&gt;Beside this I suggest to use a real calendar with a single KEY field to the fact-table (and resolving the synthetic key by doing this). Further if it's an essential requirement to show KPI's like YTD, MTD, CM and so on and might be useful to flag them within calendar and/or to use a separat calendar to select the inital period for the calculations and/or to apply an as-of-table for it. I think the following will be quite useful for your task: &lt;A href="https://community.qlik.com/t5/QlikView-Documents/How-to-use-Master-Calendar-and-Date-Values/ta-p/1495741" target="_self"&gt;How-to-use-Master-Calendar-and-Date-Values&lt;/A&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 15:26:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1612956#M45626</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-08-15T15:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1613453#M45680</link>
      <description>&lt;P&gt;Hi Macrus_sommer&lt;/P&gt;&lt;P&gt;I tried to implement your suggestions and attached the updated model. I am however still experiencing the same problem.&lt;/P&gt;&lt;P&gt;Both applying the set analysis on a numeric field or a date field (with the correctly formatted string) still exhibits the same error.&lt;/P&gt;&lt;P&gt;PS. YTD and CM are KPIs which we normally use, but using a flag inside the data load isn't appropriate because these needs to be calculated relative the the user's selection. That is why I use set analysis to search for {"&amp;lt;=$(vMaxMonth)"} or {'$(vMaxMonth)'} to calculate YTD and CM respectively.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Aug 2019 10:02:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1613453#M45680</guid>
      <dc:creator>MynhardtBurger</dc:creator>
      <dc:date>2019-08-17T10:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1613672#M45696</link>
      <description>&lt;P&gt;Unfortunately I don't have Sense available and couldn't look into your application. Quite probably there is just a small syntax- and/or data-issue and with a bit systematically testing it shouldn't be too difficult to find the cause.&lt;/P&gt;&lt;P&gt;If a set analysis with variables/expressions don't work replace them with fixed values to check if the expression itself worked - you need to be sure before you tries to find and fix issues within the set analysis. If your manually values work and the expression returned the expected value you could apply the variables/expressions again - maybe not so whole one else so detailed as possible and then step by step adding them together ...&lt;/P&gt;&lt;P&gt;Quite useful is also to apply the variables/expressions from the set analysis within another object (table, kpi, ...) to see their results there and maybe also wrapping them with num(), isnum() and similar checking if the values behind the visual display have the right values.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 07:38:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1613672#M45696</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-08-19T07:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617564#M45967</link>
      <description>&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;I've narrowed the problem down to how the [Sort] value is being calculated based on the row/column in the pivot table. If I replace [Sort] in my pick function with a hardcoded value (eg. 2), then it calculates properly.&lt;/P&gt;&lt;P&gt;So when there is no [Item] for a selected [Year Month Date] period, then [Sort] returns NULL, breaking the Pick() expression. This is evaluated for each cell in the pivot table independently. See my 3rd screenshot as well.&lt;/P&gt;&lt;P&gt;How do I ensure that [Sort] returns a value relating to the pivot table column [Heading] field, whether the is data in the [Item] row dimension in the user's selection or not?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried using combinations of the following with no success:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ValueList() as a synthetic dimension&lt;/LI&gt;&lt;LI&gt;Using Match() in the pick function&lt;/LI&gt;&lt;LI&gt;ValueList() as a syntehetic dimension combined with Match(ValueList()) in the pick function. This causes other weird effects as well.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to avoid padding my raw data with 0 rows for all combinations of [Item] and [Year Month Date].&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my expression:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pick(
    [Sort],
    Sum({1&amp;lt;[Year Month Date]={'$(vMaxYearMonthDate)'}&amp;gt;} Sales),
    Sum({1&amp;lt;[Year Month Date]={"&amp;lt;=$(vMaxYearMonthDate)"}&amp;gt;} Sales)
)&lt;/LI-CODE&gt;&lt;P&gt;vMaxYearMonthDate: =Date(Max([Year Month Date]),'YYYY-MMM')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2019-08-28 124859.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17959i324A666D8003D5B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-08-28 124859.png" alt="Annotation 2019-08-28 124859.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2019-08-28 125108.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17960i948899EEF5EFA6FE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-08-28 125108.png" alt="Annotation 2019-08-28 125108.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2019-08-28 130110.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17961i4FEAE6EEAB04CE84/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-08-28 130110.png" alt="Annotation 2019-08-28 130110.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 11:10:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617564#M45967</guid>
      <dc:creator>MynhardtBurger</dc:creator>
      <dc:date>2019-08-28T11:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617584#M45969</link>
      <description>&lt;P&gt;Can you try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pick(
    Only({1} TOTAL &amp;lt;[Sort]&amp;gt; [Sort]),
    Sum({1&amp;lt;[Year Month Date]={'$(vMaxYearMonthDate)'}&amp;gt;} Sales),
    Sum({1&amp;lt;[Year Month Date]={"&amp;lt;=$(vMaxYearMonthDate)"}&amp;gt;} Sales)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 28 Aug 2019 11:37:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617584#M45969</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-08-28T11:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617596#M45970</link>
      <description>&lt;P&gt;Hi Sunny_talwar,&lt;/P&gt;&lt;P&gt;That doesn't work. &lt;EM&gt;Only({1} TOTAL &amp;lt;[Sort]&amp;gt; [Sort])&lt;/EM&gt; doesn't return anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached the latest version of the example for reference.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 11:55:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617596#M45970</guid>
      <dc:creator>MynhardtBurger</dc:creator>
      <dc:date>2019-08-28T11:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617601#M45971</link>
      <description>&lt;P&gt;Generating missing values within the script is not unusual to avoid the various trouble with NULL. Of course a whole cartesian product of zero-values could become quite expensive but often you need to do it only for certain sub-set of your data and could be therefore more suitable as to handle the NULL anywhere in the UI.&lt;/P&gt;&lt;P&gt;From the effect a bit similar is not to use a synthetic UI listing with value-list/loop else to create them as native table in the script. This could be done with something like:&lt;/P&gt;&lt;P&gt;t: load recno() as ValueListDimension autogenerate 5;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 12:02:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617601#M45971</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-08-28T12:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617618#M45973</link>
      <description>&lt;P&gt;Can you try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pick(
    Only({1} TOTAL &amp;lt;Heading&amp;gt; [Sort]),
    Sum({1&amp;lt;[Year Month Date]={'$(vMaxYearMonthDate)'}&amp;gt;} Sales),
    Sum({1&amp;lt;[Year Month Date]={"&amp;lt;=$(vMaxYearMonthDate)"}&amp;gt;} Sales)
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 28 Aug 2019 12:40:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1617618#M45973</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-08-28T12:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Pick function not working</title>
      <link>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1618050#M46034</link>
      <description>&lt;P&gt;Thanks Sunny_talwar.&lt;/P&gt;&lt;P&gt;After your initial suggestion I also looked into how TOTAL works with the &amp;lt;&lt;EM&gt;Field list&amp;gt; &lt;/EM&gt;qualifier and happened upon the same solution you showed. &lt;A href="https://help.qlik.com/en-US/sense/June2019/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/define-aggregation-scope.htm" target="_blank" rel="noopener"&gt;Defining the aggregation scope&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I ended up using the following, as I wanted the user to still be able to select only "Current Month" or "Year to date" on the headings:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pick(
    Only(TOTAL &amp;lt;[Heading]&amp;gt; [Sort]),
    Sum({1&amp;lt;[Year Month Date]={'$(vMaxYearMonthDate)'}&amp;gt;} Sales),
    Sum({1&amp;lt;[Year Month Date]={"&amp;lt;=$(vMaxYearMonthDate)"}&amp;gt;} Sales)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to Marcus as well for your help, especially with the calendar links.&lt;/P&gt;&lt;P&gt;In my main application where this was the problem, creating missing values to avoid NULL ballooned the data set from 2m rows to 50+m and impacted the performance. I am glad I can avoid that now.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 07:58:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pick-function-not-working/m-p/1618050#M46034</guid>
      <dc:creator>MynhardtBurger</dc:creator>
      <dc:date>2019-08-29T07:58:12Z</dc:date>
    </item>
  </channel>
</rss>

