<?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: Set Analysis - Average of one field where another field is equal to monthly maximum in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Average-of-one-field-where-another-field-is-equal/m-p/1644451#M48064</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;try this expression&lt;/P&gt;&lt;P&gt;&amp;nbsp;FirstSortedValue(aggr(avg(Temprature),Depth,Month),-aggr(Depth,Depth,Month))&lt;/P&gt;&lt;P&gt;where month is a field i created in the script by using this expression : monthstart(Date)&lt;/P&gt;</description>
    <pubDate>Thu, 07 Nov 2019 18:34:06 GMT</pubDate>
    <dc:creator>lironbaram</dc:creator>
    <dc:date>2019-11-07T18:34:06Z</dc:date>
    <item>
      <title>Set Analysis - Average of one field where another field is equal to monthly maximum</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Average-of-one-field-where-another-field-is-equal/m-p/1644430#M48060</link>
      <description>&lt;P&gt;I have sensor data that takes readings of temperature at different depths every day. I want to have a table that lists the average temperature each month for only readings taken at the *maximum* depth for that month.&lt;/P&gt;&lt;P&gt;Example input data:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Depth&lt;/TD&gt;&lt;TD&gt;Temperature&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/1/2009&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/1/2009&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1/15/2009&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;38&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2/2/2009&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2/2/2009&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired output:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Avg Temp at Deepest&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jan-2009&lt;/TD&gt;&lt;TD&gt;39&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Feb-2009&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been trying every set expression I can think of, but it's not giving me the correct results.&lt;/P&gt;&lt;P&gt;I tried&amp;nbsp;Avg({&amp;lt;Depth={"$(=Max(Depth))"}&amp;gt;}Temperature), but that just returned null for each month, *unless* I selected a specific month, and then it would give me the correct value (but just for that month).&lt;/P&gt;&lt;P&gt;I tried Avg({&amp;lt;ID=P({&amp;lt;Depth={"$(=Max(Depth))"}&amp;gt;})&amp;gt;} Temperature), but that gave me values that were just wrong.&lt;/P&gt;&lt;P&gt;I even tried some Avg(Aggr(Avg(... expressions, but couldn't get them to work either.&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 18:28:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Average-of-one-field-where-another-field-is-equal/m-p/1644430#M48060</guid>
      <dc:creator>bchastai</dc:creator>
      <dc:date>2021-12-23T18:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - Average of one field where another field is equal to monthly maximum</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-Average-of-one-field-where-another-field-is-equal/m-p/1644451#M48064</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;try this expression&lt;/P&gt;&lt;P&gt;&amp;nbsp;FirstSortedValue(aggr(avg(Temprature),Depth,Month),-aggr(Depth,Depth,Month))&lt;/P&gt;&lt;P&gt;where month is a field i created in the script by using this expression : monthstart(Date)&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 18:34:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-Average-of-one-field-where-another-field-is-equal/m-p/1644451#M48064</guid>
      <dc:creator>lironbaram</dc:creator>
      <dc:date>2019-11-07T18:34:06Z</dc:date>
    </item>
  </channel>
</rss>

