<?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 Selecting distinct years from a dimension in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Selecting-distinct-years-from-a-dimension/m-p/55963#M321</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i'm creating a qvd from a fact table that has multiple date dimensions associated with it.&lt;/P&gt;&lt;P&gt;I want to do a couple of things.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Pull only the dates I will be loading from the fact table which I can do with the following query.&lt;/LI&gt;&lt;LI&gt;Display only the distinct Years from those dates to the users.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The problem is that these are actually different dimension keys so I will get duplicate years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to extract just the unique years but still have the dim keys to associate with the model?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; wpdd.plcy_dt_dim_key, PLCY_DT_YR_YY &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; "Policy Year",wpdd.*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;From&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; AWH.WR_MTD_COMB_DTL_F wmcdf, AWH.WR_VAL_DT_D, awh.wr_plcy_dt_d wpdd&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; wmcdf.VAL_DT_DIM_KEY = WR_VAL_DT_D.VAL_DT_DIM_KEY&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; wpdd.plcy_dt_dim_key = wmcdf.plcy_dt_dim_key&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; AWH.WR_VAL_DT_D.VAL_DT_DAY_MDY &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;'01-JAN-2013'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; AWH.WR_VAL_DT_D.VAL_DT_DAY_MDY &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;'01-JAN-2018'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;order&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Apr 2018 15:36:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-04-04T15:36:23Z</dc:date>
    <item>
      <title>Selecting distinct years from a dimension</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Selecting-distinct-years-from-a-dimension/m-p/55963#M321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i'm creating a qvd from a fact table that has multiple date dimensions associated with it.&lt;/P&gt;&lt;P&gt;I want to do a couple of things.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Pull only the dates I will be loading from the fact table which I can do with the following query.&lt;/LI&gt;&lt;LI&gt;Display only the distinct Years from those dates to the users.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The problem is that these are actually different dimension keys so I will get duplicate years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to extract just the unique years but still have the dim keys to associate with the model?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; wpdd.plcy_dt_dim_key, PLCY_DT_YR_YY &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; "Policy Year",wpdd.*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;From&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; AWH.WR_MTD_COMB_DTL_F wmcdf, AWH.WR_VAL_DT_D, awh.wr_plcy_dt_d wpdd&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; wmcdf.VAL_DT_DIM_KEY = WR_VAL_DT_D.VAL_DT_DIM_KEY&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; wpdd.plcy_dt_dim_key = wmcdf.plcy_dt_dim_key&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; AWH.WR_VAL_DT_D.VAL_DT_DAY_MDY &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;'01-JAN-2013'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; AWH.WR_VAL_DT_D.VAL_DT_DAY_MDY &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;'01-JAN-2018'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;order&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2018 15:36:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Selecting-distinct-years-from-a-dimension/m-p/55963#M321</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-04T15:36:23Z</dc:date>
    </item>
  </channel>
</rss>

