<?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: Set Analysis for a semi-additive metric in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-Analysis-for-a-semi-additive-metric/m-p/981674#M14233</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the FirstSortedValue() function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample Script:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Year(Date) as Year,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Month(Date) as Month,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; MonthName(Date) as MonthYear,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; 'Q' &amp;amp; Ceil(Month(Date)/3) &amp;amp; '-' &amp;amp; Right(Year(Date), 2) as QuarterYear,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Ceil(Rand() * 1000000) as Value;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Date(MakeDate(2013, 12, 31) + RecNo()) as Date&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AutoGenerate (Today() - MakeDate(2013, 12, 31));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drill Down Group: &lt;STRONG&gt;Year -&amp;gt; QuarterYear -&amp;gt; MonthYear&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Expression: &lt;STRONG style="font-size: 13.3333px;"&gt;=FirstSortedValue(Value, -Date)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/109889_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Dec 2015 18:04:14 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2015-12-23T18:04:14Z</dc:date>
    <item>
      <title>Set Analysis for a semi-additive metric</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-for-a-semi-additive-metric/m-p/981673#M14232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am currently attempting to replace an old Essbase cube with a Qlik Sense app. The cube pulls it's data from a semi-additive daily snapshot table in our data warehouse. The metric fields in that table are semi-additive in the sense that they can be summed across all dimensions except time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To match the functionality of the cube, I have created several drill down dimensions, including one called Period (Year&amp;gt;Quarter&amp;gt;Month&amp;gt;Date). I would like to create a set analysis that sums the metrics by all dimensions, except the Period dimension. In the case of the Period dimension, I would like to app to display the last value (most recent) in the selected period. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;When I am on the year level of the Period dimension, the app should show the metric value for the date of:&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;2014: 12/31/2014&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;2015: 12/22/2015 (that is the most recent snapshot as of today)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM style="text-decoration: underline;"&gt;When I am on the quarter level of the Period dimension, the app should show the metric value for the date of&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;Q3-15: 9/30/2015&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;Q4-15: 12/22/2015 (that is the most recent snapshot as of today)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM style="text-decoration: underline;"&gt;When I am on the month level of the Period dimension, the app should show the metric value for the date of:&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;Sep-15: 9/30/2015&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;Oct-15: 10/31/2015&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;Nov-15: 11/30/2015&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;Dec-15: 12/22/2015 (that is the most recent snapshot as of today)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been able to connect the app directly to the cube, but I would like to eventually get rid of the cube. So, if anyone has any suggestions on how to accomplish using set analysis, I would greatly appreciate it.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Thanks,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Dec 2015 17:42:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-for-a-semi-additive-metric/m-p/981673#M14232</guid>
      <dc:creator />
      <dc:date>2015-12-23T17:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis for a semi-additive metric</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-for-a-semi-additive-metric/m-p/981674#M14233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the FirstSortedValue() function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample Script:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Year(Date) as Year,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Month(Date) as Month,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; MonthName(Date) as MonthYear,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; 'Q' &amp;amp; Ceil(Month(Date)/3) &amp;amp; '-' &amp;amp; Right(Year(Date), 2) as QuarterYear,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Ceil(Rand() * 1000000) as Value;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Date(MakeDate(2013, 12, 31) + RecNo()) as Date&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AutoGenerate (Today() - MakeDate(2013, 12, 31));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drill Down Group: &lt;STRONG&gt;Year -&amp;gt; QuarterYear -&amp;gt; MonthYear&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Expression: &lt;STRONG style="font-size: 13.3333px;"&gt;=FirstSortedValue(Value, -Date)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/109889_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Dec 2015 18:04:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-for-a-semi-additive-metric/m-p/981674#M14233</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-12-23T18:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis for a semi-additive metric</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-for-a-semi-additive-metric/m-p/981675#M14234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try sum(aggr(FirstSortedValue(Amount, -Date), Dim1, Dim2,..., DimN). Replace Amount and Date with the appropriate field names and replace &lt;SPAN style="font-size: 13.3333px;"&gt;Dim1, Dim2,..., DimN with the field names of the chart dimensions.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Dec 2015 18:08:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-for-a-semi-additive-metric/m-p/981675#M14234</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-12-23T18:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis for a semi-additive metric</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-for-a-semi-additive-metric/m-p/981676#M14235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for you quick responses. Both helped me get to a solution. I forgot to mention in my first post that I have more than one type of measure in my fact table, so I need to use Set Analysis in addition to the functions. Here are two of the expressions that I am using in my app:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue({$&amp;lt;[METRIC_TYPE] = {'ACCOUNT COUNT'}&amp;gt;} Aggr(Sum({$&amp;lt;[METRIC_TYPE] = {'ACCOUNT COUNT'}&amp;gt;} METRIC), PERIOD), -PERIOD)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;FirstSortedValue({$&amp;lt;[METRIC_TYPE] = {'EVENT COUNT'}&amp;gt;} Aggr(Sum({$&amp;lt;[METRIC_TYPE] = {'EVENT COUNT'}&amp;gt;} METRIC), PERIOD), -PERIOD)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jan 2016 16:47:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-for-a-semi-additive-metric/m-p/981676#M14235</guid>
      <dc:creator />
      <dc:date>2016-01-08T16:47:51Z</dc:date>
    </item>
  </channel>
</rss>

