<?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 Dynamic Dimension for AGGR() using Pick(Match) in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508460#M104530</link>
    <description>&lt;P&gt;Hello!&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some Background:&amp;nbsp; I have a table that is calculating Price/Volume/Mix Effects between a Base and a Comp Period.&amp;nbsp; The table is dynamic in that the Unit of Measure and Dimension(s) are chosen by the user.&amp;nbsp; Additionally, the Totals for these effects need to be the sum of the individual effects by dimension (no problem in a straight table as the Totals function can be set to Sum in Properties.&lt;/P&gt;
&lt;P&gt;The Problem:&amp;nbsp; I want to provide this data in a Pivot Table (no Totals function option in properties) and Waterfall chart (no dimensions) and so I am trying to aggregate the sum across the chosen dimensions in the measure formula.&lt;/P&gt;
&lt;P&gt;I have tried the following formula, but it is evaluating to zero in the table and the chart:&lt;/P&gt;
&lt;P&gt;sum({[Comp Period]}aggr(([PVM Unit] - [PVM Unit Comp])*[PVM Price/Unit Comp],&lt;/P&gt;
&lt;P&gt;Pick(Match(GetFieldSelections(DimName_PVM), 'Item Price Group - Grade', 'H0', 'H0B', 'H1', 'H2', 'H3', 'Customer'),&lt;BR /&gt;[Item Price Group - Grade],&lt;BR /&gt;[H0],&lt;BR /&gt;[H0B],&lt;BR /&gt;[H1],&lt;BR /&gt;[H2],&lt;BR /&gt;[H3],&lt;BR /&gt;[Customer])&lt;/P&gt;
&lt;P&gt;))&lt;/P&gt;
&lt;P&gt;I have also tried putting the Pick(Match) part into a variable with no success (but perhaps I am not doing it correctly?!)&amp;nbsp; Also, this does work as desired if I explicitly name the dimensions for the aggregation, so I am fairly certain the problem is with the Pick(Match).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully I have given a thorough explanation, but please let me know if more info is needed.&amp;nbsp; Any suggestions to try would be most helpful and appreciated!&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Mar 2025 16:15:49 GMT</pubDate>
    <dc:creator>PIous_314</dc:creator>
    <dc:date>2025-03-05T16:15:49Z</dc:date>
    <item>
      <title>Dynamic Dimension for AGGR() using Pick(Match)</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508460#M104530</link>
      <description>&lt;P&gt;Hello!&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some Background:&amp;nbsp; I have a table that is calculating Price/Volume/Mix Effects between a Base and a Comp Period.&amp;nbsp; The table is dynamic in that the Unit of Measure and Dimension(s) are chosen by the user.&amp;nbsp; Additionally, the Totals for these effects need to be the sum of the individual effects by dimension (no problem in a straight table as the Totals function can be set to Sum in Properties.&lt;/P&gt;
&lt;P&gt;The Problem:&amp;nbsp; I want to provide this data in a Pivot Table (no Totals function option in properties) and Waterfall chart (no dimensions) and so I am trying to aggregate the sum across the chosen dimensions in the measure formula.&lt;/P&gt;
&lt;P&gt;I have tried the following formula, but it is evaluating to zero in the table and the chart:&lt;/P&gt;
&lt;P&gt;sum({[Comp Period]}aggr(([PVM Unit] - [PVM Unit Comp])*[PVM Price/Unit Comp],&lt;/P&gt;
&lt;P&gt;Pick(Match(GetFieldSelections(DimName_PVM), 'Item Price Group - Grade', 'H0', 'H0B', 'H1', 'H2', 'H3', 'Customer'),&lt;BR /&gt;[Item Price Group - Grade],&lt;BR /&gt;[H0],&lt;BR /&gt;[H0B],&lt;BR /&gt;[H1],&lt;BR /&gt;[H2],&lt;BR /&gt;[H3],&lt;BR /&gt;[Customer])&lt;/P&gt;
&lt;P&gt;))&lt;/P&gt;
&lt;P&gt;I have also tried putting the Pick(Match) part into a variable with no success (but perhaps I am not doing it correctly?!)&amp;nbsp; Also, this does work as desired if I explicitly name the dimensions for the aggregation, so I am fairly certain the problem is with the Pick(Match).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hopefully I have given a thorough explanation, but please let me know if more info is needed.&amp;nbsp; Any suggestions to try would be most helpful and appreciated!&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 16:15:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508460#M104530</guid>
      <dc:creator>PIous_314</dc:creator>
      <dc:date>2025-03-05T16:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dimension for AGGR() using Pick(Match)</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508467#M104531</link>
      <description>&lt;P&gt;Try this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a variable in script&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SET vDimPVM = Pick(&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Match(GetFieldSelections(DimName_PVM),&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Item Price Group - Grade', 'H0', 'H0B', 'H1', 'H2', 'H3', 'Customer'),&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; [Item Price Group - Grade],&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; [H0],&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; [H0B],&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; [H1],&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; [H2],&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; [H3],&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; [Cus&lt;SPAN&gt;tomer]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And use that inside aggr()&lt;/P&gt;
&lt;P&gt;Sum({[Comp Period]} Aggr(&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; ([PVM Unit] - [PVM Unit Comp]) * [PVM Price/Unit Comp],&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; $(vDimPVM)&lt;/P&gt;
&lt;P&gt;))&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 17:17:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508467#M104531</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2025-03-05T17:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dimension for AGGR() using Pick(Match)</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508485#M104533</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; I tried this and it doesn't work... the full calculation is returning zero everywhere.&amp;nbsp; Here are the results of looking at the variable in a few ways:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Text Box (regardless of any dimensions selected or not)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;=vDimPVM returns the text of the Pick(Match) formula entered in the script&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;=$(vDimPVM) returns nothing&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Straight Table with single dimension selected (H3)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;=$(vDimPVM) returns the individual field values of H3 corresponding to the dimension column&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 21:51:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508485#M104533</guid>
      <dc:creator>PIous_314</dc:creator>
      <dc:date>2025-03-05T21:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dimension for AGGR() using Pick(Match)</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508580#M104542</link>
      <description>&lt;P&gt;The dimensions for the aggr() must be a valid field-reference - not an expression-result as string or field.&lt;/P&gt;
&lt;P&gt;I think I would go in this direction:&lt;/P&gt;
&lt;P&gt;sum({&lt;STRONG&gt;&amp;lt;&lt;/STRONG&gt; [Comp Period]&lt;STRONG&gt; &amp;gt;&lt;/STRONG&gt; } &lt;BR /&gt;&amp;nbsp; &amp;nbsp;aggr(([PVM Unit] - [PVM Unit Comp]) * [PVM Price/Unit Comp],&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;$(=concat('[' &amp;amp; DimName_PVM &amp;amp; ']', ','))&lt;/STRONG&gt;))&lt;/P&gt;
&lt;P&gt;Beside this make sure that the base-calculation - without the aggr() - and with aggr() and fixed set dimensions - without any dynamic stuff is working like expected. Because there is no further aggregation-function included which means that only() is applied and further there is no exception handling and each non numerical return in any part will set it to NULL.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 11:52:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508580#M104542</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-03-06T11:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dimension for AGGR() using Pick(Match)</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508614#M104548</link>
      <description>&lt;P&gt;Thank you for your response!&lt;/P&gt;
&lt;P&gt;This *almost* works for the case where a single dimension has been selected.&amp;nbsp; In the case where [PVM Unit] = 0, your formula is evaluating to zero as well (when it should be the negative of the revenue in the comp period).&amp;nbsp; When I add a measure that is just&amp;nbsp;$(=concat('[' &amp;amp; DimName_PVM &amp;amp; ']', ',')) to the table for these same records, it is showing NULL (gray box with a dash) and the individual field value for the records where the calculation is correct.&lt;/P&gt;
&lt;P&gt;When trying with multiple dimensions there are many more records that do not match (although some of them do?) and beyond the case described above, I cannot see a clear pattern to understand why.&lt;/P&gt;
&lt;P&gt;I can confirm that the base calculation, both without aggr() and with aggr() using fixed set dimensions does work.&amp;nbsp; [PVM Unit], [[PVM Unit Comp], and&amp;nbsp;&lt;SPAN&gt;[PVM Price/Unit Comp] are all master items and exception handling happens in the formulas for those.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 14:21:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508614#M104548</guid>
      <dc:creator>PIous_314</dc:creator>
      <dc:date>2025-03-06T14:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dimension for AGGR() using Pick(Match)</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508619#M104550</link>
      <description>&lt;P&gt;Checking the concat() results in an expression is a good idea but then without the $-sign expansion - just:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;concat('[' &amp;amp; DimName_PVM &amp;amp; ']', ',')&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and also similar to various measure-fields, like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;concat(distinct [PVM Unit], ' + ')&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 14:48:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508619#M104550</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-03-06T14:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dimension for AGGR() using Pick(Match)</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508655#M104563</link>
      <description>&lt;P&gt;Is there something specific I should be checking for?&amp;nbsp; This doesn't change the suggested solution not working in all cases.&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 16:49:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508655#M104563</guid>
      <dc:creator>PIous_314</dc:creator>
      <dc:date>2025-03-06T16:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dimension for AGGR() using Pick(Match)</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508719#M104577</link>
      <description>&lt;P&gt;It wasn't meant as solution else as a way to detect some of the possible causes underlying the not expected results, for example if any of the concat() results of the measure-fields in regard to the chosen dimensionality is NULL or returned not a single value else n concatenated values it would mean that the data-set and/or the associations within data-model aren't suitable for your view.&lt;/P&gt;
&lt;P&gt;If the concat() discovered any invalid data/associations you should look directly on the data by pulling all relevant fields into a table-box - and then selecting the data-set to those parts which return not the wanted results and then you will very probably find some NULL and/or missing associations and/or n different values per dimensionality. You need to know your data-set exactly before you could adjust the object-views and/or the data-set.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 07:36:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2508719#M104577</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-03-07T07:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dimension for AGGR() using Pick(Match)</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2509544#M104724</link>
      <description>&lt;P&gt;Just to follow up, here is how I ended up solving this problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I never was able to get Pick(Match()) to work properly (there still may be a way, I just wasn't able to sort it out) so I went a different route.&amp;nbsp; I added a field to the DimPVM table that includes the expression as below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PIous_314_0-1741790932985.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/178460iF6338D680B702A4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PIous_314_0-1741790932985.png" alt="PIous_314_0-1741790932985.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then I used DimExpression_PVM in the Filter Pane for the user to select and now the measure formula I use is:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sum({[Comp Period]}aggr(([PVM Unit] - [PVM Unit Comp])*[PVM Price/Unit Comp],&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;GetFieldSelections(DimExpression_PVM)))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This works everywhere all of the time as desired with the Totals function (in Straight Table with Totals function Auto, in Pivot Table with no Totals function choice, and a Waterfall chart with no dimension).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you to everyone, I still learned a lot from your responses!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 14:57:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Dimension-for-AGGR-using-Pick-Match/m-p/2509544#M104724</guid>
      <dc:creator>PIous_314</dc:creator>
      <dc:date>2025-03-12T14:57:49Z</dc:date>
    </item>
  </channel>
</rss>

