<?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: Dynamic Total in Pivot Table in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137619#M92468</link>
    <description>&lt;P&gt;Yes, it works as you suggested, even though qlik yields an error which confused me. Thank you very much!&lt;/P&gt;
&lt;P&gt;In a next step I try to match it the Dimensionality in order to expand the &amp;lt;TYPE&amp;gt; part dynamically. I tried something like this but it does not work:&lt;/P&gt;
&lt;P&gt;Sum(total &amp;lt;$(=GetObjectDimension (0))$(=If(Dimensionality() &amp;gt;= 2, ',' &amp;amp; GetObjectDimension (1)))&amp;gt;[SALES_EUR])&lt;/P&gt;
&lt;P&gt;So similarly to your expression it should add another &amp;lt;TYPE&amp;gt; Dimension if we have at least 2 row dimensions in a pivot table. Do you have any suggestions on what I missed?&lt;/P&gt;
&lt;P&gt;(I could also add your part "&lt;SPAN&gt;not IsNull(GetObjectDimension (1))" to the expression but I suppose it is not needed if we are able to work with Dimensionality. The GetObjectDimension part seems to not account for switching a dimension from column to row.&lt;/SPAN&gt;)&lt;/P&gt;</description>
    <pubDate>Tue, 14 Nov 2023 14:47:57 GMT</pubDate>
    <dc:creator>Tim_G</dc:creator>
    <dc:date>2023-11-14T14:47:57Z</dc:date>
    <item>
      <title>Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137137#M92415</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;
&lt;P&gt;I woul like to calculate the total of a row in a pivot table. Usually this works well with "Sum(total &amp;lt;TYPE&amp;gt; SALES)"&lt;/P&gt;
&lt;P&gt;In my example I use it to calculate the market share such as follows:&lt;/P&gt;
&lt;P&gt;Sum([SALES_EUR])&lt;BR /&gt;/Sum(total &amp;lt;YEAR,COUNTRY&amp;gt; [SALES_EUR])&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tim_G_0-1699873775755.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/119789i48E29F9BFF08834A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tim_G_0-1699873775755.png" alt="Tim_G_0-1699873775755.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However this total by TYPE is fixed on the dimensions YEAR,COUNTRY here. If I want wo change dimensions such that e.g. PRODUCTGROUP is a row and COUNTRY becomes a column than I get incorrect totals.&lt;/P&gt;
&lt;P&gt;If I move PRODUCTGROUP to the left by drag and drop, then I would like to become the formualr "Sum(total &amp;lt;PRODUCTGROUP&amp;gt; [SALES_EUR])" dynamically? Maybe dimensionality() could help but I could not figure it out yet.&lt;/P&gt;
&lt;P&gt;Thanks in advance, Tim&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 11:15:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137137#M92415</guid>
      <dc:creator>Tim_G</dc:creator>
      <dc:date>2023-11-13T11:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137151#M92416</link>
      <description>&lt;P&gt;Hi, maybe you could use &lt;A href="https://help.qlik.com/en-US/sense/August2023/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FieldFunctions/getobjectdimension.htm" target="_self"&gt;GetObjectDimension()&lt;/A&gt;&amp;nbsp;to dynamically change the fields included in total, but it could be difficult if the number od horizontal and vertical dimensions changes.&lt;/P&gt;
&lt;P&gt;It could be something like:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Sum(total &amp;lt;$(=GetObjectDimension (0))$(=If(not IsNull(GetObjectDimension (1)),',' &amp;amp;GetObjectDimension (1))&amp;gt; [SALES_EUR])&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 11:29:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137151#M92416</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-11-13T11:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137508#M92456</link>
      <description>&lt;P&gt;Hi, that was a nice hint!&lt;/P&gt;
&lt;P&gt;I created a Master Dimension such that it always yields the Name of the lowest dimension. However, this is done with N if statements where N is the maximum number of dimensions possible in a our pivot table. Let's make it 5 here:&lt;/P&gt;
&lt;P&gt;If(not isnull(GetObjectDimension (4)),GetObjectDimension (4),&lt;BR /&gt;If(not isnull(GetObjectDimension (3)),GetObjectDimension (3),&lt;BR /&gt;If(not isnull(GetObjectDimension (2)),GetObjectDimension (2),&lt;BR /&gt;If(not isnull(GetObjectDimension (1)),GetObjectDimension (1),&lt;BR /&gt;GetObjectDimension (0)))))&lt;/P&gt;
&lt;P&gt;I call this dimension DIMHELP. The next step however would be the formular to total over this dimension like this:&lt;/P&gt;
&lt;P&gt;=Sum(total &amp;lt;[DIMHELP]&amp;gt; SALES_EUR)&lt;/P&gt;
&lt;P&gt;Unfortunately this does not work. Do you have any thought on this?&lt;/P&gt;
&lt;P&gt;This post here deals with this issue, however I do not really know what is done here. They say one should load the Master Dimension in the Load Script. I can't find any instructions how to do that. But I suppose we are close to a solution.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/App-Development/Count-TOTAL-lt-Master-Dimension-gt-Product/td-p/45839" target="_blank" rel="noopener"&gt;https://community.qlik.com/t5/App-Development/Count-TOTAL-lt-Master-Dimension-gt-Product/td-p/45839&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 09:46:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137508#M92456</guid>
      <dc:creator>Tim_G</dc:creator>
      <dc:date>2023-11-14T09:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137527#M92461</link>
      <description>&lt;P&gt;Hi,I don't think that post manages the cahange of horizontal to vertical dimensions.&lt;/P&gt;
&lt;P&gt;The option I proposed was to use the $-expansion to create the TOTAL fields inside the same TOTAL clause, and in a way that is manages change of the number of dimensions.&lt;/P&gt;
&lt;P&gt;Have you tested it as I posted?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 10:35:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137527#M92461</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-11-14T10:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137619#M92468</link>
      <description>&lt;P&gt;Yes, it works as you suggested, even though qlik yields an error which confused me. Thank you very much!&lt;/P&gt;
&lt;P&gt;In a next step I try to match it the Dimensionality in order to expand the &amp;lt;TYPE&amp;gt; part dynamically. I tried something like this but it does not work:&lt;/P&gt;
&lt;P&gt;Sum(total &amp;lt;$(=GetObjectDimension (0))$(=If(Dimensionality() &amp;gt;= 2, ',' &amp;amp; GetObjectDimension (1)))&amp;gt;[SALES_EUR])&lt;/P&gt;
&lt;P&gt;So similarly to your expression it should add another &amp;lt;TYPE&amp;gt; Dimension if we have at least 2 row dimensions in a pivot table. Do you have any suggestions on what I missed?&lt;/P&gt;
&lt;P&gt;(I could also add your part "&lt;SPAN&gt;not IsNull(GetObjectDimension (1))" to the expression but I suppose it is not needed if we are able to work with Dimensionality. The GetObjectDimension part seems to not account for switching a dimension from column to row.&lt;/SPAN&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 14:47:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2137619#M92468</guid>
      <dc:creator>Tim_G</dc:creator>
      <dc:date>2023-11-14T14:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2139108#M92590</link>
      <description>&lt;P&gt;Hi, I don't think Dimensionality() would work inside a $-expansion because it's expanded before the cells are calculated, maybe with this workaround:&lt;/P&gt;
&lt;P&gt;=If(Dimensionality()&amp;gt;=3&lt;BR /&gt;,Sum(total &amp;lt;$(=GetObjectDimension(0))$(=','&amp;amp; GetObjectDimension(1))&amp;gt; [SALES_EUR])&lt;BR /&gt;,Sum(total &amp;lt;$(=GetObjectDimension(0))&amp;gt; [SALES_EUR])&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Sat, 18 Nov 2023 18:23:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2139108#M92590</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-11-18T18:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140343#M92717</link>
      <description>&lt;P&gt;Hey, thanks for the workaround!&lt;/P&gt;
&lt;P&gt;Unfortunately it doesn't work with the if(Dimensionality() part. The Sum expression is totally fine. Do you have an idea?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tim_G_0-1700661100995.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/120406iE2C2F25CEBDF47CB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tim_G_0-1700661100995.png" alt="Tim_G_0-1700661100995.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 13:52:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140343#M92717</guid>
      <dc:creator>Tim_G</dc:creator>
      <dc:date>2023-11-22T13:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140356#M92719</link>
      <description>&lt;P&gt;Hi, you need to close the If, with a parenthesys at the end.&lt;/P&gt;
&lt;P&gt;Also note that my answer has another excpression for the 'else' part of the if.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 14:13:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140356#M92719</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-11-22T14:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140360#M92720</link>
      <description>&lt;P&gt;I did that, even if it is not visible in the screenshot. The full expression is as follows:&lt;/P&gt;
&lt;P&gt;If(Dimensionality()&amp;gt;=2,&lt;BR /&gt;,Sum(total &amp;lt;$(=GetObjectDimension(0))$(=','&amp;amp; GetObjectDimension(1))&amp;gt; [SALES_EUR])&lt;BR /&gt;,Sum(total &amp;lt;$(=GetObjectDimension(0))&amp;gt; [SALES_EUR]))&lt;/P&gt;
&lt;P&gt;Both Sum expressions work on their own without the IF statement.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 14:17:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140360#M92720</guid>
      <dc:creator>Tim_G</dc:creator>
      <dc:date>2023-11-22T14:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140362#M92721</link>
      <description>&lt;P&gt;You have 2 consecutive commas, remove the one after &amp;gt;=2&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 14:19:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140362#M92721</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2023-11-22T14:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Total in Pivot Table</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140364#M92722</link>
      <description>&lt;P&gt;Oof, I missed that. So sorry!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":sad_but_relieved_face:"&gt;😥&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 14:21:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-Total-in-Pivot-Table/m-p/2140364#M92722</guid>
      <dc:creator>Tim_G</dc:creator>
      <dc:date>2023-11-22T14:21:57Z</dc:date>
    </item>
  </channel>
</rss>

