<?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 perform calculations on a new field from a Join in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-perform-calculations-on-a-new-field-from-a-Join/m-p/2054687#M86645</link>
    <description>&lt;P&gt;Hello, the resultant table will only contain the most recent records with matching records from Table MaxDate.&lt;/P&gt;
&lt;P&gt;Hence you could use the below.&lt;/P&gt;
&lt;P&gt;Count({$&amp;lt;[OOD Flag]={1}&amp;gt;} DISTINCT [Component Equip Numb])&lt;/P&gt;</description>
    <pubDate>Sat, 01 Apr 2023 16:38:17 GMT</pubDate>
    <dc:creator>BrunPierre</dc:creator>
    <dc:date>2023-04-01T16:38:17Z</dc:date>
    <item>
      <title>How to perform calculations on a new field from a Join</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-perform-calculations-on-a-new-field-from-a-Join/m-p/2054612#M86635</link>
      <description>&lt;P&gt;The title probably makes no sense, but I don't know how else to put it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a fairly simple data set, which is just records of maintenance jobs performed on pieces of equipment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I recently came here for help on pulling only the&amp;nbsp;&lt;STRONG&gt;latest&lt;/STRONG&gt; records for each piece of equipment, which was solved (using the join function at the bottom of my script) but now I am not sure how I would perform count and sum calculations etc. as the way I am doing it now is returning incorrect figures.&lt;/P&gt;
&lt;P&gt;For example. if I want to count how many pieces of equipment are 'out of date' ([OOD FLAG]), how can I make sure it's only counting based on the latest date (max_date)?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see my full script below (with irrelevant fields omitted):&lt;/P&gt;
&lt;P&gt;MaxDate:&lt;BR /&gt;LOAD&lt;BR /&gt;num("Component Equip Numb") as "Component Equip Numb" ,&lt;BR /&gt;"Equipment Name Code",&lt;BR /&gt;"Component Asset Stat", &lt;BR /&gt;"SCHEDULED FREQUENCY",&lt;BR /&gt;"Stat Date",&lt;BR /&gt;"Work Group",&lt;/P&gt;
&lt;P&gt;if(date(today()&amp;gt;([Stat Date]+[SCHEDULED FREQUENCY])), '1', '0') as [OOD Flag]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM [lib://SourceDataFiles/xxx.qvx]&lt;BR /&gt;(qvx);&lt;/P&gt;
&lt;P&gt;RIGHT JOIN (MaxDate)&lt;BR /&gt;LOAD&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; num("Component Equip Numb") as "Component Equip Numb",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Work Group",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Component Asset Stat",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATE(MAX("Stat Date"), 'DD/MM/YYYY') As Max_Date&lt;BR /&gt;Resident MaxDate&lt;BR /&gt;WHERE MATCH ("Work Group", 'AM') AND MATCH ("Component Asset Stat", 'IN','MB')&lt;BR /&gt;GROUP BY "Component Equip Numb", "Work Group", "Component Asset Stat";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 11:28:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-perform-calculations-on-a-new-field-from-a-Join/m-p/2054612#M86635</guid>
      <dc:creator>Sam_Thomas</dc:creator>
      <dc:date>2023-03-29T11:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform calculations on a new field from a Join</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-perform-calculations-on-a-new-field-from-a-Join/m-p/2054687#M86645</link>
      <description>&lt;P&gt;Hello, the resultant table will only contain the most recent records with matching records from Table MaxDate.&lt;/P&gt;
&lt;P&gt;Hence you could use the below.&lt;/P&gt;
&lt;P&gt;Count({$&amp;lt;[OOD Flag]={1}&amp;gt;} DISTINCT [Component Equip Numb])&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2023 16:38:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-perform-calculations-on-a-new-field-from-a-Join/m-p/2054687#M86645</guid>
      <dc:creator>BrunPierre</dc:creator>
      <dc:date>2023-04-01T16:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform calculations on a new field from a Join</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-perform-calculations-on-a-new-field-from-a-Join/m-p/2054737#M86651</link>
      <description>&lt;P&gt;Thanks for this. I did try this expression before I asked the question on here and got the same answer, however I assumed it was wrong because the number was way higher than I thought. However, there appears to be another data issue at source level that is skewing the figures rather than the expression! Thanks for your answer, nonetheless!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 14:42:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-perform-calculations-on-a-new-field-from-a-Join/m-p/2054737#M86651</guid>
      <dc:creator>Sam_Thomas</dc:creator>
      <dc:date>2023-03-29T14:42:36Z</dc:date>
    </item>
  </channel>
</rss>

