<?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 to aggregate on calculated (or associated) dimension value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658139#M448483</link>
    <description>&lt;P&gt;alternative, Flag method approach&lt;/P&gt;&lt;P&gt;Data:&lt;BR /&gt;LOAD *,&lt;STRONG&gt; if(Group=RefGroup,1,0) as Flag&lt;/STRONG&gt; INLINE [&lt;BR /&gt;Group, RefGroup, Value&lt;BR /&gt;1A, 1Ref, 1&lt;BR /&gt;1B, 1Ref, 2&lt;BR /&gt;1C, 1Ref, 3&lt;BR /&gt;1Ref, 1Ref, 10&lt;BR /&gt;2A, 2Ref, 4&lt;BR /&gt;2B, 2Ref, 5&lt;BR /&gt;2Ref, 2Ref, 20&lt;BR /&gt;3A, 3Ref, 6&lt;BR /&gt;3B, 3Ref, 7&lt;BR /&gt;3C, 3Ref, 8&lt;BR /&gt;3Ref, 3Ref, 30 ];&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ref Sum expression:&amp;nbsp;=sum(total &amp;lt;RefGroup&amp;gt; aggr(sum({&amp;lt;Flag={1}&amp;gt;} Value),Group))&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Dec 2019 16:00:41 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2019-12-16T16:00:41Z</dc:date>
    <item>
      <title>Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1654689#M448091</link>
      <description>&lt;P&gt;I need to create a straight table where the aggregations in one column must be based on a specific/associated dimension, but it's no the dimension 'at that level' in the table.&amp;nbsp; &amp;nbsp;I've created a simple project to illustrate (attached).&lt;/P&gt;&lt;P&gt;For example, consider the following data.&amp;nbsp; Notice we have a &lt;STRONG&gt;Group&lt;/STRONG&gt; field by which we want to aggregate the &lt;STRONG&gt;Value&lt;/STRONG&gt; field.&amp;nbsp; Each Group has a specific group that we'll want to aggregate in the same row.&amp;nbsp; So for Groups &lt;STRONG&gt;1A&lt;/STRONG&gt;, &lt;STRONG&gt;1B&lt;/STRONG&gt;, &lt;STRONG&gt;1C&lt;/STRONG&gt;... the &lt;STRONG&gt;RefGroup&lt;/STRONG&gt; (reference group) group is &lt;STRONG&gt;1Ref&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="refsum_data.PNG" style="width: 300px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/25184i8CEFDA1B5FC92272/image-size/large?v=v2&amp;amp;px=999" role="button" title="refsum_data.PNG" alt="refsum_data.PNG" /&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the table below, we have the desired output.&amp;nbsp; So we see the two dimensions (&lt;STRONG&gt;Group&lt;/STRONG&gt; and &lt;STRONG&gt;RefGroup&lt;/STRONG&gt;).&amp;nbsp; Our first metric (&lt;STRONG&gt;Sum&lt;/STRONG&gt;) is just an normal aggregation on the Group.&amp;nbsp; The 2nd metric (&lt;STRONG&gt;Ref Sum&lt;/STRONG&gt;) is an aggregation for the RefGroup associated with that Group.&amp;nbsp; So for 1A, 1B, and 1C, it's going to be an aggregation of Group = 1Ref.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="refsum.PNG" style="width: 406px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/25014iD668518231C90148/image-size/large?v=v2&amp;amp;px=999" role="button" title="refsum.PNG" alt="refsum.PNG" /&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;In sample data above, the *Ref values are always larger than the other values, but this is fake data, the actual values will vary.&amp;nbsp; &amp;nbsp;And in the final output, we'll exclude the 'Ref' dimensions from Group, so they will not appear.&amp;nbsp; So we'll see rows for 1A, 1B, 1C, 2A, 2B, 3A, 3B, and 3C.&lt;/P&gt;&lt;P&gt;The question is how to create that 2nd metric above (&lt;STRONG&gt;Ref Sum&lt;/STRONG&gt;) so that is aggregates just the value where essentially Group=RefGroup.&lt;/P&gt;&lt;P&gt;I've tried varying Set Analysis solutions, but since Set Analysis is not evaluated row-by-row, perhaps it's not possible?&amp;nbsp; I'm hitting a wall on this, and hoping someone can help.&amp;nbsp; Thanks so much for any ideas or insights.&lt;/P&gt;&lt;P&gt;NOTE:&amp;nbsp; If this is not possible via an expression, by plan B is to pre-aggregate values in the model as another table. But before going that route, I'd prefer to create an expression in the chart if possible.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:45:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1654689#M448091</guid>
      <dc:creator>DeltaHotel</dc:creator>
      <dc:date>2024-11-16T01:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1657715#M448462</link>
      <description>&lt;P&gt;Are you precluded from calculating Ref Sum in the script?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finding the maximum of Value grouped by RefGroup gets what you display as desired output.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 21:09:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1657715#M448462</guid>
      <dc:creator>johnca</dc:creator>
      <dc:date>2019-12-13T21:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658057#M448475</link>
      <description>&lt;P&gt;Thanks for the reply.&amp;nbsp; No, that's certainly an option.&amp;nbsp; So I could just create another table with the aggregates (sums) grouped by RefGroup (where Group=RefGroup).&amp;nbsp; For example:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;TableRef:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;LOAD &lt;/FONT&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;RefGroup, &lt;/FONT&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;sum(Value) as RefValue&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;Resident Table1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;where Group = RefGroup&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2" color="#0000FF"&gt;group by RefGroup;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Looks like this is indeed what I'll have to do. But I posted here just because this &lt;STRONG&gt;&lt;EM&gt;seems&lt;/EM&gt; &lt;/STRONG&gt;like something that should be possible at the record-level in a chart, using Set Analysis perhaps.&amp;nbsp; So I just wanted to get the input of folks here to see if I was missing something.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 13:32:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658057#M448475</guid>
      <dc:creator>DeltaHotel</dc:creator>
      <dc:date>2019-12-16T13:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658107#M448477</link>
      <description>&lt;P&gt;It doesn't appear you are using the sum function though, but you certainly could. More like the max value. I used;&lt;/P&gt;&lt;P&gt;Table1:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Group, RefGroup, Value&lt;BR /&gt;1A, 1Ref, 1&lt;BR /&gt;1B, 1Ref, 2&lt;BR /&gt;1C, 1Ref, 3&lt;BR /&gt;1Ref, 1Ref, 10&lt;BR /&gt;2A, 2Ref, 4&lt;BR /&gt;2B, 2Ref, 5&lt;BR /&gt;2Ref, 2Ref, 20&lt;BR /&gt;3A, 3Ref, 6&lt;BR /&gt;3B, 3Ref, 7&lt;BR /&gt;3C, 3Ref, 8&lt;BR /&gt;3Ref, 3Ref, 30&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;/* Get max */&lt;/P&gt;&lt;P&gt;MaxRefValue:&lt;BR /&gt;Left Join(Table1)&lt;BR /&gt;Load Distinct&lt;BR /&gt;Max(Value) as RefMax,&lt;BR /&gt;RefGroup&lt;BR /&gt;Resident Table1&lt;BR /&gt;Group By RefGroup;&lt;/P&gt;&lt;P&gt;/* Get sum */&lt;/P&gt;&lt;P&gt;SumRefValue:&lt;BR /&gt;Left Join(Table1)&lt;BR /&gt;Load Distinct&lt;BR /&gt;Sum(Value) as RefSum,&lt;BR /&gt;RefGroup&lt;BR /&gt;Resident Table1&lt;BR /&gt;Where Not WildMatch(Group,'*ref*')&lt;BR /&gt;Group By RefGroup;&lt;/P&gt;&lt;P&gt;If you desire the record level within a table approach I'm sure someone here can do it. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 14:46:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658107#M448477</guid>
      <dc:creator>johnca</dc:creator>
      <dc:date>2019-12-16T14:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658121#M448479</link>
      <description>&lt;P&gt;Thanks again John.&lt;/P&gt;&lt;P&gt;I'm using the SUM in the way I did because for all records where RefGroup="1Ref", I need to get the sum where RefGroup="1Ref" AND Group="1Ref".&amp;nbsp; So I don't want to sum all the 1Ref records, and I don't want the max() cause it won't always be the max.&lt;/P&gt;&lt;P&gt;So all those that are 1A, 1B, and 1C will be 10, because that's the value of the RefGroup ("1Ref") for those records.&amp;nbsp; But it's just 10 in my fake data here. It could be that the 1Ref/1Ref value is 2, for example.&lt;/P&gt;&lt;P&gt;All good suggestions though, and helpful feedback.&amp;nbsp; Thank you again!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 15:07:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658121#M448479</guid>
      <dc:creator>DeltaHotel</dc:creator>
      <dc:date>2019-12-16T15:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658138#M448482</link>
      <description>&lt;P&gt;Data:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Group, RefGroup, Value&lt;BR /&gt;1A, 1Ref, 1&lt;BR /&gt;1B, 1Ref, 2&lt;BR /&gt;1C, 1Ref, 3&lt;BR /&gt;1Ref, 1Ref, 10&lt;BR /&gt;2A, 2Ref, 4&lt;BR /&gt;2B, 2Ref, 5&lt;BR /&gt;2Ref, 2Ref, 20&lt;BR /&gt;3A, 3Ref, 6&lt;BR /&gt;3B, 3Ref, 7&lt;BR /&gt;3C, 3Ref, 8&lt;BR /&gt;3Ref, 3Ref, 30 ];&lt;/P&gt;&lt;P&gt;Left Join(Data)&lt;BR /&gt;Load RefGroup,&lt;BR /&gt;sum(Value) as [Ref Sum]&lt;BR /&gt;Resident Data&lt;BR /&gt;where Group=RefGroup&lt;BR /&gt;Group by RefGroup;&lt;/P&gt;&lt;P&gt;Now, simply add Sum([Ref Sum]) expression in chart&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 15:34:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658138#M448482</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2019-12-16T15:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658139#M448483</link>
      <description>&lt;P&gt;alternative, Flag method approach&lt;/P&gt;&lt;P&gt;Data:&lt;BR /&gt;LOAD *,&lt;STRONG&gt; if(Group=RefGroup,1,0) as Flag&lt;/STRONG&gt; INLINE [&lt;BR /&gt;Group, RefGroup, Value&lt;BR /&gt;1A, 1Ref, 1&lt;BR /&gt;1B, 1Ref, 2&lt;BR /&gt;1C, 1Ref, 3&lt;BR /&gt;1Ref, 1Ref, 10&lt;BR /&gt;2A, 2Ref, 4&lt;BR /&gt;2B, 2Ref, 5&lt;BR /&gt;2Ref, 2Ref, 20&lt;BR /&gt;3A, 3Ref, 6&lt;BR /&gt;3B, 3Ref, 7&lt;BR /&gt;3C, 3Ref, 8&lt;BR /&gt;3Ref, 3Ref, 30 ];&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ref Sum expression:&amp;nbsp;=sum(total &amp;lt;RefGroup&amp;gt; aggr(sum({&amp;lt;Flag={1}&amp;gt;} Value),Group))&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:00:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658139#M448483</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2019-12-16T16:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658144#M448484</link>
      <description>&lt;P&gt;or just expression approach&lt;/P&gt;&lt;P&gt;=sum(total &amp;lt;RefGroup&amp;gt; aggr(sum({&amp;lt;Group={"=Group=RefGroup"}&amp;gt;} Value),Group))&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:07:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658144#M448484</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2019-12-16T16:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658149#M448485</link>
      <description>&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;P&gt;I like the ideas offered here on both using a Flag in the model or just JOIN'ing to add the aggregation to the model.&lt;/P&gt;&lt;P&gt;But doing with straight SET ANALYSIS was the initial objective, and you've offered just that solution. I had danced around it, but I was neglecting to use TOTAL &amp;lt;RefGroup&amp;gt; to limit dimensions for the AGGR().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:33:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658149#M448485</guid>
      <dc:creator>DeltaHotel</dc:creator>
      <dc:date>2019-12-16T16:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to aggregate on calculated (or associated) dimension value</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658158#M448487</link>
      <description>&lt;P&gt;Glad that it worked&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:59:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-aggregate-on-calculated-or-associated-dimension/m-p/1658158#M448487</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2019-12-16T16:59:13Z</dc:date>
    </item>
  </channel>
</rss>

