<?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 Kaplan Meier Estimator with a second dimension in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Kaplan-Meier-Estimator-with-a-second-dimension/m-p/110978#M7623</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I succeed to implement the Kaplan Meier estimator inside a line chart in Qlik Sense like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="kaplan.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/217590_kaplan.png" style="height: 241px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;To do that, I write this expression which is the exact transcription of KM Estimator&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15414922044104991" jivemacro_uid="_15414922044104991"&gt;
&lt;P&gt;&lt;CODE style="font-style: inherit; font-weight: inherit; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;"&gt;= if(RowNo() = 1, 1, &lt;BR /&gt;&amp;nbsp; (1 - (count({&amp;lt;Analyse_Type = {'Churn'}&amp;gt;}%Key_Contract) /&lt;BR /&gt;&amp;nbsp; count({&amp;lt;Analyse_Type = {'Parc'}&amp;gt;}%Key_Contract))) * above(Column(1))&lt;BR /&gt;)&lt;/CODE&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything works fine but I'd like to add a second dimension in the graph and when I do that, the recursive above seems to get muddle up. &lt;SPAN style="font-size: 10pt;"&gt;I try to aggregate the above by my second dimension but it is not working.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Does someone have an idea to do that? Or another way to write the Kaplan Meier estimator without the using of a recursion?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Nov 2018 08:20:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-11-06T08:20:38Z</dc:date>
    <item>
      <title>Kaplan Meier Estimator with a second dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Kaplan-Meier-Estimator-with-a-second-dimension/m-p/110978#M7623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I succeed to implement the Kaplan Meier estimator inside a line chart in Qlik Sense like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="kaplan.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/217590_kaplan.png" style="height: 241px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;To do that, I write this expression which is the exact transcription of KM Estimator&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15414922044104991" jivemacro_uid="_15414922044104991"&gt;
&lt;P&gt;&lt;CODE style="font-style: inherit; font-weight: inherit; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;"&gt;= if(RowNo() = 1, 1, &lt;BR /&gt;&amp;nbsp; (1 - (count({&amp;lt;Analyse_Type = {'Churn'}&amp;gt;}%Key_Contract) /&lt;BR /&gt;&amp;nbsp; count({&amp;lt;Analyse_Type = {'Parc'}&amp;gt;}%Key_Contract))) * above(Column(1))&lt;BR /&gt;)&lt;/CODE&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything works fine but I'd like to add a second dimension in the graph and when I do that, the recursive above seems to get muddle up. &lt;SPAN style="font-size: 10pt;"&gt;I try to aggregate the above by my second dimension but it is not working.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Does someone have an idea to do that? Or another way to write the Kaplan Meier estimator without the using of a recursion?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2018 08:20:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Kaplan-Meier-Estimator-with-a-second-dimension/m-p/110978#M7623</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-06T08:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Kaplan Meier Estimator with a second dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Kaplan-Meier-Estimator-with-a-second-dimension/m-p/110979#M7624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you have more than one dimension you often have to have a &lt;STRONG&gt;TOTAL&lt;/STRONG&gt; in the Above() function (or any of it's sibling functions that belong to the inter-record functions). Similarly the RowNo() function also needs a TOTAL ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So maybe this will work:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt; font-style: inherit; font-weight: inherit; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15415275494383263" jivemacro_uid="_15415275494383263" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; font-style: inherit; font-weight: inherit; color: black;"&gt;if(RowNo(TOTAL) = 1, 1,&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; (1 - (count({&amp;lt;Analyse_Type = {'Churn'}&amp;gt;}%Key_Contract) /&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; count({&amp;lt;Analyse_Type = {'Parc'}&amp;gt;}%Key_Contract))) * Above(&lt;STRONG&gt;TOTAL&lt;/STRONG&gt; Column(1)) &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: black; font-size: 9pt; font-style: inherit; font-weight: inherit;"&gt;) &lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2018 18:05:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Kaplan-Meier-Estimator-with-a-second-dimension/m-p/110979#M7624</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-11-06T18:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Kaplan Meier Estimator with a second dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Kaplan-Meier-Estimator-with-a-second-dimension/m-p/110980#M7625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good to know about the TOTAL inside sibling functions but I tried your solution and here's what I get:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="217705" alt="kaplan2.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/217705_kaplan2.png" style="height: 204px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems like the above function does not work anymore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you an idea why this does not work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Edit:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I find a solution to my issue. I switch the way to make a accumulation of product (the recursive above) by the mathematical logic &lt;BR /&gt;&lt;STRONG&gt;exp(rangeSum(log()))&lt;/STRONG&gt;. I aggregate the rangeSum by my second dimension ordered by my first dimension (the interval) and everything works fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the final expression of the Kaplan Meier Estimator:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15415789657824201 jive_text_macro" jivemacro_uid="_15415789657824201" modifiedtitle="true"&gt;
&lt;P&gt;exp(aggr(Rangesum(Above(log(fabs(&lt;/P&gt;
&lt;P&gt;(1 - (count({&amp;lt;Analyse_Type = {'Churn'}&amp;gt;}%Key_Contract) / count({&amp;lt;Analyse_Type = {'SurvivalParc'}&amp;gt;}%Key_Contract)))) ),0, Rowno()))&lt;/P&gt;
&lt;P&gt;, REGION, (Delivered_Days_5, NUMERIC, ASCENDING))) &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and here is the visual result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="kaplan3.png" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/217740_kaplan3.png" style="height: 286px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2018 08:02:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Kaplan-Meier-Estimator-with-a-second-dimension/m-p/110980#M7625</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-07T08:02:47Z</dc:date>
    </item>
  </channel>
</rss>

