<?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: Change expression based on pivot table dimension in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Change-expression-based-on-pivot-table-dimension/m-p/1553147#M39846</link>
    <description>&lt;P&gt;The aggr didn't quite work, but your suggestion gave me a great idea. I can add the TOTAL qualifier and include every dimension except [Student].&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;=if(count(DISTINCT TOTAL&amp;lt;[Districts], [Buildings], [Teachers]&amp;gt; [Students]) &amp;lt; 20, '&amp;lt;20', avg([Measure Field]))&lt;/PRE&gt;&lt;P&gt;I think that was what you were going for with the aggr suggestion, but for my purposes this is a little cleaner. It still has an issue when there are fewer than 20 students at the teacher level, but for what I need it works just fine.&lt;/P&gt;&lt;P&gt;While this solves my specific issue, it would be interesting to hear if there is a way to accomplish what I was initially asking. If there is a way to determine what dimension the expression is calculating over within the expression, but I'm pretty sure the answer is there is not.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Mar 2019 17:36:38 GMT</pubDate>
    <dc:creator>dselgo_eidex</dc:creator>
    <dc:date>2019-03-06T17:36:38Z</dc:date>
    <item>
      <title>Change expression based on pivot table dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Change-expression-based-on-pivot-table-dimension/m-p/1552634#M39830</link>
      <description>&lt;P&gt;Hello. I am currently trying to put together a complex pivot table and I am running into a snag. Below is an example of what I am working with:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pivot_table_example.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/7324i4BAB603E66975E64/image-size/large?v=v2&amp;amp;px=999" role="button" title="pivot_table_example.PNG" alt="pivot_table_example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have a pivot table with District, Building, Teacher, and Student as dimensions. I want to show the average of a field at each dimension level as long as there are at least 20 students in the set, otherwise show '&amp;lt;20':&lt;/P&gt;&lt;PRE&gt;=if(count(DISTINCT [Students]) &amp;lt; 20, '&amp;lt;20', avg([Measure Field]))&lt;/PRE&gt;&lt;P&gt;I want this rule to apply to all dimension levels EXCEPT for student. Because when you expand down to the student level, the count will always be 1 and the measure will always show '&amp;lt;20'.&lt;/P&gt;&lt;P&gt;I want to know if there is a way that I can set my expression up to know which pivot table dimension it is currently calculating over. That way I could ignore the above rule when at the student level.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 06:25:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Change-expression-based-on-pivot-table-dimension/m-p/1552634#M39830</guid>
      <dc:creator>dselgo_eidex</dc:creator>
      <dc:date>2024-11-16T06:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change expression based on pivot table dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Change-expression-based-on-pivot-table-dimension/m-p/1552703#M39834</link>
      <description>&lt;P&gt;May be try this way?&lt;/P&gt;&lt;PRE&gt;=Sum(Aggr(if(count(DISTINCT [Students]) &amp;lt; 20, '&amp;lt;20', avg([Measure Field])),&lt;SPAN&gt;Building, Teacher))&lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2019 06:46:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Change-expression-based-on-pivot-table-dimension/m-p/1552703#M39834</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2019-03-06T06:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change expression based on pivot table dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Change-expression-based-on-pivot-table-dimension/m-p/1553147#M39846</link>
      <description>&lt;P&gt;The aggr didn't quite work, but your suggestion gave me a great idea. I can add the TOTAL qualifier and include every dimension except [Student].&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;=if(count(DISTINCT TOTAL&amp;lt;[Districts], [Buildings], [Teachers]&amp;gt; [Students]) &amp;lt; 20, '&amp;lt;20', avg([Measure Field]))&lt;/PRE&gt;&lt;P&gt;I think that was what you were going for with the aggr suggestion, but for my purposes this is a little cleaner. It still has an issue when there are fewer than 20 students at the teacher level, but for what I need it works just fine.&lt;/P&gt;&lt;P&gt;While this solves my specific issue, it would be interesting to hear if there is a way to accomplish what I was initially asking. If there is a way to determine what dimension the expression is calculating over within the expression, but I'm pretty sure the answer is there is not.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 17:36:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Change-expression-based-on-pivot-table-dimension/m-p/1553147#M39846</guid>
      <dc:creator>dselgo_eidex</dc:creator>
      <dc:date>2019-03-06T17:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Change expression based on pivot table dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Change-expression-based-on-pivot-table-dimension/m-p/1553250#M39848</link>
      <description>&lt;P&gt;After this I actually found a better way that is closer to what I was trying to do:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;=if(IsNull(only([Students])),
    if(count(DISTINCT [Students]) &amp;lt; 20, 
        '&amp;lt;20', 
        avg([Measure Field])),
    avg([Measure Field])
)&lt;/PRE&gt;&lt;P&gt;Basically, it will only perform the&amp;nbsp; '&amp;lt;20' part of the expression when only([Students]) is null (a.k.a. when there are more than one student), otherwise it calculates normally when at the student level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 22:16:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Change-expression-based-on-pivot-table-dimension/m-p/1553250#M39848</guid>
      <dc:creator>dselgo_eidex</dc:creator>
      <dc:date>2019-03-06T22:16:31Z</dc:date>
    </item>
  </channel>
</rss>

