<?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: Measure using P() and AGGR in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2502979#M103538</link>
    <description>&lt;P&gt;Hi, when I add date to your sample app it looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubenmarin_0-1737961217378.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176878iF37AE8B85C68A401/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rubenmarin_0-1737961217378.png" alt="rubenmarin_0-1737961217378.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And when I selct a Date the value is the same&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubenmarin_1-1737961249035.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176879i041B331D4591AD4D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rubenmarin_1-1737961249035.png" alt="rubenmarin_1-1737961249035.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The behaviour you describe is what happens when you use a table with a dimension that doesn't exists in the aggr, in that case when the atggr dimesnion combiations could match differnt dimension values, the aggr assign combinations to the first value (in this case the 1/1), and removes the data from other dates, so only when you select a date those values that matches many different dates goes to that date.&lt;/P&gt;
&lt;P&gt;So double check you really add the Date dimension to aggr, that higher value on 1/1 is very suspiciosuis that the aggr is not using Date as dimension.&lt;/P&gt;
&lt;P&gt;This works on the sample app:&lt;/P&gt;
&lt;P&gt;sum(aggr(&lt;BR /&gt;Sum({1&amp;lt;HSCKEY=P(HSCKEY),ProductGroup -= {'17','18','19'},TransactionBreak = {'1'}&amp;gt;} TransactionNetWeight),&lt;BR /&gt;Date,MasterLocation,Room,TransactionNumber))&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jan 2025 07:06:22 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2025-01-27T07:06:22Z</dc:date>
    <item>
      <title>Measure using P() and AGGR</title>
      <link>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2502900#M103520</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am struggling to get a measure to work using the P() function with AGGR. This is my measure&lt;/P&gt;
&lt;P&gt;sum(aggr(&lt;BR /&gt;Sum({1&amp;lt;HSCKEY=P(HSCKEY),ProductGroup -= {'17','18','19'},TransactionBreak = {'1'}&amp;gt;} TransactionNetWeight),&lt;BR /&gt;MasterLocation,Room,TransactionNumber))&lt;/P&gt;
&lt;P&gt;and it returns this..&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hopkinsc_0-1737741525096.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176858i5F6F1C53295116A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hopkinsc_0-1737741525096.png" alt="hopkinsc_0-1737741525096.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;These are the incorrect values, they are only correct if you select an individual date..&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hopkinsc_1-1737741599615.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176859i007B49D9601D1A85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hopkinsc_1-1737741599615.png" alt="hopkinsc_1-1737741599615.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I've tried numerous things like adding the set analysis into the AGGR and the overall SUM but I can't get it to work.&lt;/P&gt;
&lt;P&gt;The first date in the table 1/1/2025 is correct though, without selecting it. Its all other dates that are wrong.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help please?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've attached a sample.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks very much&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 18:02:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2502900#M103520</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2025-01-24T18:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Measure using P() and AGGR</title>
      <link>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2502917#M103527</link>
      <description>&lt;P&gt;Hi, to keep the values by Date you'll also need to include Date dimension in the Aggr()&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sum(aggr(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sum({1&amp;lt;HSCKEY=P(HSCKEY),ProductGroup -= {'17','18','19'},TransactionBreak = {'1'}&amp;gt;} TransactionNetWeight),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;STRONG&gt;Date,&lt;/STRONG&gt;MasterLocation,Room,TransactionNumber))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jan 2025 08:02:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2502917#M103527</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2025-01-25T08:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Measure using P() and AGGR</title>
      <link>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2502972#M103537</link>
      <description>&lt;P&gt;Good morning,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply, this is the first thing i tried, but doesn't give me the required output unfortunately.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When i add Date into the AGGR, the values change but are still wrong. The correct values only display without Date in the AGGR and when i make a selection on Date.&lt;/P&gt;
&lt;P&gt;i.e.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with no date selected, 3rd Jan shows 267,142. which is the incorrect value&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hopkinsc_0-1737959240712.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176871i0BF9C30B594203AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hopkinsc_0-1737959240712.png" alt="hopkinsc_0-1737959240712.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;when i select the date, the values changes to 1,838,876 which is the correct value, but i want this value to be displayed when no selections have been made.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hopkinsc_1-1737959400615.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176872iE898B7A0F70A1878/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hopkinsc_1-1737959400615.png" alt="hopkinsc_1-1737959400615.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This currently only works for the 1st Jan value, and i don't know why..&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hopkinsc_2-1737959490408.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176873i74229808CFA83B98/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hopkinsc_2-1737959490408.png" alt="hopkinsc_2-1737959490408.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;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hopkinsc_3-1737959518455.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176874i3D929D36479B44D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hopkinsc_3-1737959518455.png" alt="hopkinsc_3-1737959518455.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There's obviously something wrong with the measure, I just can't figure out what.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 06:33:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2502972#M103537</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2025-01-27T06:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Measure using P() and AGGR</title>
      <link>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2502979#M103538</link>
      <description>&lt;P&gt;Hi, when I add date to your sample app it looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubenmarin_0-1737961217378.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176878iF37AE8B85C68A401/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rubenmarin_0-1737961217378.png" alt="rubenmarin_0-1737961217378.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And when I selct a Date the value is the same&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rubenmarin_1-1737961249035.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176879i041B331D4591AD4D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rubenmarin_1-1737961249035.png" alt="rubenmarin_1-1737961249035.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The behaviour you describe is what happens when you use a table with a dimension that doesn't exists in the aggr, in that case when the atggr dimesnion combiations could match differnt dimension values, the aggr assign combinations to the first value (in this case the 1/1), and removes the data from other dates, so only when you select a date those values that matches many different dates goes to that date.&lt;/P&gt;
&lt;P&gt;So double check you really add the Date dimension to aggr, that higher value on 1/1 is very suspiciosuis that the aggr is not using Date as dimension.&lt;/P&gt;
&lt;P&gt;This works on the sample app:&lt;/P&gt;
&lt;P&gt;sum(aggr(&lt;BR /&gt;Sum({1&amp;lt;HSCKEY=P(HSCKEY),ProductGroup -= {'17','18','19'},TransactionBreak = {'1'}&amp;gt;} TransactionNetWeight),&lt;BR /&gt;Date,MasterLocation,Room,TransactionNumber))&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 07:06:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2502979#M103538</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2025-01-27T07:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Measure using P() and AGGR</title>
      <link>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2503017#M103548</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When i add Date in the AGGR the values are not right. Obviously, when i then select a date, the values stays as it was without a date selected. That is what i want, but the values are wrong.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the results of the table with and without Date added into the AGGR&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hopkinsc_0-1737972551047.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176891i5659E515FA841E0C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hopkinsc_0-1737972551047.png" alt="hopkinsc_0-1737972551047.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but these are the values I am expecting to see.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hopkinsc_1-1737972606004.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/176892iB1DE145671E441D5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hopkinsc_1-1737972606004.png" alt="hopkinsc_1-1737972606004.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I only get the correct values when each date is selected individually (without Date in the AGGR)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 10:10:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2503017#M103548</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2025-01-27T10:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Measure using P() and AGGR</title>
      <link>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2503056#M103556</link>
      <description>&lt;P&gt;Before struggling further with UI expressions make sure that the underlying data are like you expect them and that the used data-model and table-associations are suitable for your wanted views.&lt;/P&gt;
&lt;P&gt;It may not mandatory easy but I would start with a table-box with all fields from the object (used in dimensions and expressions) as well as within any selections + an unique record-identifier - if none exists you could create one with recno() and/or rowno(). I wouldn't be surprised if there are any unexpected data - duplicates, missing keys, null, ...&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 13:41:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measure-using-P-and-AGGR/m-p/2503056#M103556</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-01-27T13:41:27Z</dc:date>
    </item>
  </channel>
</rss>

