<?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 Calculated Dimension in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculated-Dimension/m-p/196510#M56558</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi There&lt;/P&gt;&lt;P&gt;I have a basic graph with sales for example.&lt;/P&gt;&lt;P&gt;I want the dimension for the graph to be Year when no year is selected or Month when there is a year selected.&lt;/P&gt;&lt;P&gt;To test this is possible i enter the following in the calculated dimension expression:&lt;/P&gt;&lt;P&gt;=if(1=1,Year,Month)&lt;/P&gt;&lt;P&gt;This work when i change the 1=1 to 1&amp;lt;&amp;gt;1, the dimension changes to Month or Year accordingly.&lt;/P&gt;&lt;P&gt;BUT ic annot get this to work:&lt;/P&gt;&lt;P&gt;=if(count(distinct(Year))=1,Month,Year)&lt;/P&gt;&lt;P&gt;It just says error in calculated dimension, obviously I am just checking to see if a year is selected and then change the dimension.&lt;/P&gt;&lt;P&gt;What am I doing wrong ?&lt;/P&gt;&lt;P&gt;Thanx&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Sep 2009 20:32:36 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-09-23T20:32:36Z</dc:date>
    <item>
      <title>Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Calculated-Dimension/m-p/196510#M56558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi There&lt;/P&gt;&lt;P&gt;I have a basic graph with sales for example.&lt;/P&gt;&lt;P&gt;I want the dimension for the graph to be Year when no year is selected or Month when there is a year selected.&lt;/P&gt;&lt;P&gt;To test this is possible i enter the following in the calculated dimension expression:&lt;/P&gt;&lt;P&gt;=if(1=1,Year,Month)&lt;/P&gt;&lt;P&gt;This work when i change the 1=1 to 1&amp;lt;&amp;gt;1, the dimension changes to Month or Year accordingly.&lt;/P&gt;&lt;P&gt;BUT ic annot get this to work:&lt;/P&gt;&lt;P&gt;=if(count(distinct(Year))=1,Month,Year)&lt;/P&gt;&lt;P&gt;It just says error in calculated dimension, obviously I am just checking to see if a year is selected and then change the dimension.&lt;/P&gt;&lt;P&gt;What am I doing wrong ?&lt;/P&gt;&lt;P&gt;Thanx&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2009 20:32:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculated-Dimension/m-p/196510#M56558</guid>
      <dc:creator />
      <dc:date>2009-09-23T20:32:36Z</dc:date>
    </item>
    <item>
      <title>Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Calculated-Dimension/m-p/196511#M56559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;=if(GetSelectedCount(Year)&amp;gt;0, Month, Year)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;There are probably quite a few different methods to accomplish this, but I like the built-in QlikView selection functions. Also, see GetFieldSelections(), which will give you a list of the actual selections in a field.&lt;/P&gt;&lt;P&gt;EDIT: I think the problem with your functions is it should be:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;=if(count(distinct Year)=1,Month,Year)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2009 20:38:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculated-Dimension/m-p/196511#M56559</guid>
      <dc:creator />
      <dc:date>2009-09-23T20:38:47Z</dc:date>
    </item>
  </channel>
</rss>

