<?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: Avg Days Syntax with missing date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Avg-Days-Syntax-with-missing-date/m-p/1764266#M455262</link>
    <description>&lt;P&gt;One way could be to extract the phase-selections and to separate the single values (maybe within a variable) with something like:&lt;/P&gt;&lt;P&gt;v1: =subfield(concat(distinct ADJ_GOVERNANCE_PHASE, '+'), '+', 1)&lt;BR /&gt;v2: =subfield(concat(distinct ADJ_GOVERNANCE_PHASE, '+'), '+', 2)&lt;/P&gt;&lt;P&gt;which might be then queried like:&lt;/P&gt;&lt;P&gt;Max({&amp;lt; ADJ_GOVERNANCE_PHASE = {'$v1)'} &amp;gt; *&amp;nbsp;&amp;lt; ADJ_GOVERNANCE_PHASE = {'$v2)'} &amp;gt; }&amp;nbsp;&amp;nbsp;&lt;BR /&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; ADJ_GOVERNANCE_PHASE_START_DATE)&lt;/P&gt;&lt;P&gt;but such an approach doesn't make your already quite complex expressions easier else the opposite especially if there are not only two selected values else n values.&lt;/P&gt;&lt;P&gt;Easier than this&amp;nbsp; is probably to apply a count-approach similar to your attempt but using distinct like:&lt;/P&gt;&lt;P&gt;count(distinct ADJ_GOVERNANCE_PHASE)&lt;/P&gt;&lt;P&gt;and applying the check not within the set analysis else using it as a kind of boolean flag, this may look like:&lt;/P&gt;&lt;P&gt;sum(aggr(max()-min(), Dim)) * -(count(distinct ADJ_GOVERNANCE_PHASE)=2)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Beside this I could imagine that some logic might be better transferred into the script to simplify the UI and to reduce/avoid the need of using so many aggr-constructs. In regard to your selections-requirement the&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/And-mode%20in%20List%20Boxes.htm" target="_self"&gt;And-mode&lt;/A&gt;&amp;nbsp; might be an option.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
    <pubDate>Wed, 25 Nov 2020 09:15:45 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2020-11-25T09:15:45Z</dc:date>
    <item>
      <title>Avg Days Syntax with missing date</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-Days-Syntax-with-missing-date/m-p/1762337#M455260</link>
      <description>&lt;P&gt;I have a dashboard that allows the user to select two Phases - eg 2.2 and 3.2 and the idea is to see both the number of tickets that hit both of those phases and also the avg number of days between the phases.&lt;/P&gt;&lt;P&gt;One of the problems I have is that the current code does not allow for the scenario where a ticket hits one phase more than once but does not hit the other phase.&lt;/P&gt;&lt;P&gt;For example, ticket (&lt;STRONG&gt;DEFECT_ID&lt;/STRONG&gt;) &lt;STRONG&gt;527 never entered phase 2.2&lt;/STRONG&gt; at all but did enter &lt;STRONG&gt;phase 3.2 twice&lt;/STRONG&gt; - once on 6/8/20 and again on 6/22/20. The calculation is showing 14 days (6/22-6/8) but&lt;STRONG&gt; it should not show up at all because it did not hit phase 2.2&lt;/STRONG&gt;. How can I modify the code to still work in this and other situations? QVW attached.&lt;/P&gt;&lt;P&gt;Avg Days expression:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;sum(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Aggr(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;Max({$&amp;lt;DEFECT_ID = {"=Count(ADJ_GOVERNANCE_PHASE) = GetSelectedCount(ADJ_GOVERNANCE_PHASE)"}&amp;gt;}ADJ_GOVERNANCE_PHASE_START_DATE)- Min({$&amp;lt;DEFECT_ID = {"=Count(ADJ_GOVERNANCE_PHASE) = GetSelectedCount(ADJ_GOVERNANCE_PHASE)"}&amp;gt;}ADJ_GOVERNANCE_PHASE_START_DATE)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;,DEFECT_ID))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;/Count({$&amp;lt;DEFECT_ID = {"=Count(ADJ_GOVERNANCE_PHASE) = GetSelectedCount(ADJ_GOVERNANCE_PHASE)"}&amp;gt;}DISTINCT DEFECT_ID)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="2020-11-17_11-04-31.jpg" style="width: 504px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/44309iBCE0046FB13CADA8/image-dimensions/504x287?v=v2" width="504" height="287" role="button" title="2020-11-17_11-04-31.jpg" alt="2020-11-17_11-04-31.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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-left" image-alt="2020-11-17_11-06-03.jpg" style="width: 768px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/44310iB91B903E4F5A04E5/image-dimensions/768x94?v=v2" width="768" height="94" role="button" title="2020-11-17_11-06-03.jpg" alt="2020-11-17_11-06-03.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 23:37:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-Days-Syntax-with-missing-date/m-p/1762337#M455260</guid>
      <dc:creator>cbaqir</dc:creator>
      <dc:date>2024-11-15T23:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Avg Days Syntax with missing date</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-Days-Syntax-with-missing-date/m-p/1764266#M455262</link>
      <description>&lt;P&gt;One way could be to extract the phase-selections and to separate the single values (maybe within a variable) with something like:&lt;/P&gt;&lt;P&gt;v1: =subfield(concat(distinct ADJ_GOVERNANCE_PHASE, '+'), '+', 1)&lt;BR /&gt;v2: =subfield(concat(distinct ADJ_GOVERNANCE_PHASE, '+'), '+', 2)&lt;/P&gt;&lt;P&gt;which might be then queried like:&lt;/P&gt;&lt;P&gt;Max({&amp;lt; ADJ_GOVERNANCE_PHASE = {'$v1)'} &amp;gt; *&amp;nbsp;&amp;lt; ADJ_GOVERNANCE_PHASE = {'$v2)'} &amp;gt; }&amp;nbsp;&amp;nbsp;&lt;BR /&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; ADJ_GOVERNANCE_PHASE_START_DATE)&lt;/P&gt;&lt;P&gt;but such an approach doesn't make your already quite complex expressions easier else the opposite especially if there are not only two selected values else n values.&lt;/P&gt;&lt;P&gt;Easier than this&amp;nbsp; is probably to apply a count-approach similar to your attempt but using distinct like:&lt;/P&gt;&lt;P&gt;count(distinct ADJ_GOVERNANCE_PHASE)&lt;/P&gt;&lt;P&gt;and applying the check not within the set analysis else using it as a kind of boolean flag, this may look like:&lt;/P&gt;&lt;P&gt;sum(aggr(max()-min(), Dim)) * -(count(distinct ADJ_GOVERNANCE_PHASE)=2)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Beside this I could imagine that some logic might be better transferred into the script to simplify the UI and to reduce/avoid the need of using so many aggr-constructs. In regard to your selections-requirement the&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/And-mode%20in%20List%20Boxes.htm" target="_self"&gt;And-mode&lt;/A&gt;&amp;nbsp; might be an option.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 09:15:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-Days-Syntax-with-missing-date/m-p/1764266#M455262</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-11-25T09:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Avg Days Syntax with missing date</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-Days-Syntax-with-missing-date/m-p/1764410#M455263</link>
      <description>&lt;P&gt;May something like if&amp;nbsp;&lt;SPAN&gt;count(distinct ADJ_GOVERNANCE_PHASE)=2, then exp... thanks Marcus. I will play with it.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 14:17:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-Days-Syntax-with-missing-date/m-p/1764410#M455263</guid>
      <dc:creator>cbaqir</dc:creator>
      <dc:date>2020-11-25T14:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Avg Days Syntax with missing date</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-Days-Syntax-with-missing-date/m-p/1764413#M455264</link>
      <description>&lt;P&gt;I wonder if I could use&amp;nbsp;=if(aggr(count(distinct ADJ_GOVERNANCE_PHASE),DEFECT_ID)=2,DEFECT_ID) as a Dimension.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 14:20:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-Days-Syntax-with-missing-date/m-p/1764413#M455264</guid>
      <dc:creator>cbaqir</dc:creator>
      <dc:date>2020-11-25T14:20:01Z</dc:date>
    </item>
  </channel>
</rss>

