<?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: Clarification on set analysis use of P() for current dimension value in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116058#M8050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Dan, try this expression for Dairy&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(Sum(TOTAL &amp;lt; Customer &amp;gt; Aggr(Sum({&amp;lt; Type = {'Dairy'} &amp;gt;} [Amount Spent]), Customer) ), Product, Customer, Type))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/211813_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Aug 2018 06:49:37 GMT</pubDate>
    <dc:creator>andrey_krylov</dc:creator>
    <dc:date>2018-08-27T06:49:37Z</dc:date>
    <item>
      <title>Clarification on set analysis use of P() for current dimension value</title>
      <link>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116054#M8046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello community!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've gotten myself stuck with set analysis - I think in my use case I need to use the P(), but it seems like I am just not quite grasping how to accomplish it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Overview - In my data I have what is basically a list of what customers have purchased.&amp;nbsp; I would like to summarize this by displaying how much customers have spent (in total, and avg per customer) on a given type of product (for example, Milk and Cheese = "Dairy") when they have purchased product ABC (ABC is technically any of the values for the dimension product).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my attached file, I have a sample of the data, and an idea on what I am trying to accomplish...it is roughly something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data (Purchases)&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Customer&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Product&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Type of Product&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Amount Spent&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Milk&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Dairy&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Potatoes&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Produce&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Cheese&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Dairy&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Milk&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Dairy&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Oranges&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Produce&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Desired output:&lt;/P&gt;&lt;P&gt;Note: the way I have been thinking about this is that this is a table visualization, with the Product column populated from the dimension "Product" from my sample data, and the "For customers who bought this..." columns, I am writing a set expression for the Types I want to include that is something like this:&lt;/P&gt;&lt;P&gt;sum( {&amp;lt; [Product] =, [Type of Product] = [&amp;lt;Value of desired type of product, ie/ Dairy&amp;gt;]&amp;nbsp; &amp;gt;} Amount Spent)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It feels like I need something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum( {&amp;lt; [Product] =, [Type of Product] = [&amp;lt;Value of desired type of product, ie/ Dairy&amp;gt;], Customer = p( {&amp;lt;&amp;nbsp; [Type of Product] = [&amp;lt;Value of desired type of product, ie/ Dairy&amp;gt;] &amp;gt;} Customer)&amp;nbsp;&amp;nbsp; &amp;gt;} Amount Spent)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Product&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;For customers who bought this product, how much did they spend on Dairy?&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff; text-align: center; background-color: #6690bc;"&gt;For customers who bought this product, how much did they spend on Produce?&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Milk&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10+10+15&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;25+35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Oranges&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10+10+15&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Cheese&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10+10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For some reason, I can't quite get the results I want.&amp;nbsp; Any support would be appreciated!&amp;nbsp; My attached excel file has more detail/a more comprehensive example....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2018 14:23:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116054#M8046</guid>
      <dc:creator>daniel_dalnekoff</dc:creator>
      <dc:date>2018-08-23T14:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on set analysis use of P() for current dimension value</title>
      <link>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116055#M8047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it's correct with your desired output :&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/211636_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;P() is not convenient because it's related with selection,&lt;/P&gt;&lt;P&gt;here is aggr used&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2018 15:02:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116055#M8047</guid>
      <dc:creator>ogautier62</dc:creator>
      <dc:date>2018-08-23T15:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on set analysis use of P() for current dimension value</title>
      <link>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116056#M8048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan, you could use this expression.&lt;BR /&gt;Once for each Type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF(sum({$&amp;lt;Type ={'Dairy'} &amp;gt;} [Amount Spent]) &amp;gt; '0',SUM({&amp;lt;Type = {'Dairy'}&amp;gt;}[Amount Spent]),0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF(sum({$&amp;lt;Type ={'Bakery'} &amp;gt;} [Amount Spent]) &amp;gt; '0',SUM({&amp;lt;Type = {'Bakery'}&amp;gt;}[Amount Spent]),0)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2018 15:12:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116056#M8048</guid>
      <dc:creator>PabloTrevisan</dc:creator>
      <dc:date>2018-08-23T15:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on set analysis use of P() for current dimension value</title>
      <link>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116057#M8049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Olivier, Pablo - thank you both for your replies.&amp;nbsp; Both of your solutions did correctly solve the example I provided, and these were helpful solutions in achieving my goal.&amp;nbsp; My exact scenario was a bit more complex than I had the example (as I realized while working through it) to be, but I was able to leverage what you outlined to solve my challenge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks again,&lt;/P&gt;&lt;P&gt;DD&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2018 01:54:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116057#M8049</guid>
      <dc:creator>daniel_dalnekoff</dc:creator>
      <dc:date>2018-08-27T01:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on set analysis use of P() for current dimension value</title>
      <link>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116058#M8050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Dan, try this expression for Dairy&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(Sum(TOTAL &amp;lt; Customer &amp;gt; Aggr(Sum({&amp;lt; Type = {'Dairy'} &amp;gt;} [Amount Spent]), Customer) ), Product, Customer, Type))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/211813_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2018 06:49:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Clarification-on-set-analysis-use-of-P-for-current-dimension/m-p/116058#M8050</guid>
      <dc:creator>andrey_krylov</dc:creator>
      <dc:date>2018-08-27T06:49:37Z</dc:date>
    </item>
  </channel>
</rss>

