<?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: Median question in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Median-question/m-p/957539#M328906</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For some reason the editor (whilst posting above) froze and I was not able to complete my question:&lt;/P&gt;&lt;P&gt;- Have I used the median correctly?&lt;/P&gt;&lt;P&gt;- Can you see more efficient ways of doing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Alexis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 07 Nov 2015 16:44:14 GMT</pubDate>
    <dc:creator>alexis</dc:creator>
    <dc:date>2015-11-07T16:44:14Z</dc:date>
    <item>
      <title>Median question</title>
      <link>https://community.qlik.com/t5/QlikView/Median-question/m-p/957538#M328905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have some performance issues and I am looking at ways of improving performance - one of the worst culprits is the below (especially Q4 the &lt;STRONG&gt;Median&lt;/STRONG&gt;) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am creating an application that is dealing with &lt;STRONG&gt;Transactions&lt;/STRONG&gt; and &lt;STRONG&gt;Credit Cards&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We need to answer the following questions (KPIs) for the time period and filters chosen:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Q1) Total number of transactions&lt;/P&gt;&lt;P&gt;Q2) Total number of unique cards used&lt;/P&gt;&lt;P&gt;Q3) Average number of transactions per unique card&lt;/P&gt;&lt;P&gt;Q4) Median transactions per unique card&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To answer these questions I created variables as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;vTotalTransactionsSet1&lt;/STRONG&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;= sum({&amp;lt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[numAuthorisationDate] = {'&amp;gt;=$(vStartDate1)&amp;lt;=$(vEndDate1)'},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Year] = [Group1]::[Authorisations Year],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Quarter] = [Group1]::[Authorisations Quarter],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Month] = [Group1]::[Authorisations Month],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Week] = [Group1]::[Authorisations Week],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Day] = [Group1]::[Authorisations Day],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[TerminalsID] = {'&amp;lt;&amp;gt; 00'},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[TransactionAmmount] = {'&amp;gt; 0'}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;gt;} AuthorisationRec)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note:&lt;/P&gt;&lt;P&gt;a) I am using SUM of a record id field I created (value-=1) instead of COUNT for efficiency.&lt;/P&gt;&lt;P&gt;b) The [Group1] reference is because we use comparative analysis - I have the same set of formula for [Group2]&lt;/P&gt;&lt;P&gt;c) All the "calendar" fields are of the type [Authorisations...]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;vTotalUniqueCardNumbersSet1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;=count({&amp;lt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[numAuthorisationDate] = {'&amp;gt;=$(vStartDate1)&amp;lt;=$(vEndDate1)'},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Year] = [Group1]::[Authorisations Year],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Quarter] = [Group1]::[Authorisations Quarter],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Month] = [Group1]::[Authorisations Month],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Week] = [Group1]::[Authorisations Week],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[Authorisations Day] = [Group1]::[Authorisations Day],&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[TerminalsID] = {'&amp;lt;&amp;gt; 00'},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;[TransactionAmmount] = {'&amp;gt; 0'}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;gt;} distinct [CardNumber])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Q1) Total number of transactions:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;= num($(vTotalTransactionsSet1))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Q2) Total number of unique cards used&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;EM&gt;= num(&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM style="font-family: courier new,courier;"&gt;$(vTotalUniqueCardNumbersSet1))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Q3)&lt;/STRONG&gt; &lt;STRONG&gt;Average number of transactions per unique card&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;EM&gt;= num($(vTotalTransactionsSet1)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-family: courier new,courier;"&gt;/&amp;nbsp; $(vTotalUniqueCardNumbersSet1))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Q4) Median transactions per unique card&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;= $(vMedianTransactionsPerUniqueCardSet1)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that is defined as:&lt;/P&gt;&lt;P&gt;= Median(Aggr(sum({&amp;lt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[numAuthorisationDate] = {'&amp;gt;=$(vStartDate1)&amp;lt;=$(vEndDate1)'},&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Year] = [Group1]::[Authorisations Year],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Quarter] = [Group1]::[Authorisations Quarter],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Month] = [Group1]::[Authorisations Month],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Week] = [Group1]::[Authorisations Week],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Day] = [Group1]::[Authorisations Day],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[TerminalsID] = {'&amp;lt;&amp;gt; 00'},&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[TransactionAmmount] = {'&amp;gt; 0'}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;} AuthorisationRec)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count({&amp;lt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[numAuthorisationDate] = {'&amp;gt;=$(vStartDate1)&amp;lt;=$(vEndDate1)'},&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Year] = [Group1]::[Authorisations Year],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Quarter] = [Group1]::[Authorisations Quarter],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Month] = [Group1]::[Authorisations Month],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Week] = [Group1]::[Authorisations Week],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Authorisations Day] = [Group1]::[Authorisations Day],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[TerminalsID] = {'&amp;lt;&amp;gt; 00'},&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[TransactionAmmount] = {'&amp;gt; 0'}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;} distinct [CardNumber]), [CardNumber]))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Nov 2015 16:41:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-question/m-p/957538#M328905</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2015-11-07T16:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Median question</title>
      <link>https://community.qlik.com/t5/QlikView/Median-question/m-p/957539#M328906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For some reason the editor (whilst posting above) froze and I was not able to complete my question:&lt;/P&gt;&lt;P&gt;- Have I used the median correctly?&lt;/P&gt;&lt;P&gt;- Can you see more efficient ways of doing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Alexis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Nov 2015 16:44:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-question/m-p/957539#M328906</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2015-11-07T16:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Median question</title>
      <link>https://community.qlik.com/t5/QlikView/Median-question/m-p/957540#M328907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The divisor in your median aggr() expression should be always 1, thus it can be removed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;= Median(&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Aggr(&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;sum({&amp;lt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[numAuthorisationDate] = {'&amp;gt;=$(vStartDate1)&amp;lt;=$(vEndDate1)'},&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Authorisations Year] = [Group1]::[Authorisations Year],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Authorisations Quarter] = [Group1]::[Authorisations Quarter],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Authorisations Month] = [Group1]::[Authorisations Month],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Authorisations Week] = [Group1]::[Authorisations Week],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Authorisations Day] = [Group1]::[Authorisations Day],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[TerminalsID] = {'&amp;lt;&amp;gt; 00'},&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[TransactionAmmount] = {'&amp;gt; 0'}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;gt;} AuthorisationRec)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="line-height: 1.5em;"&gt;, [CardNumber]))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Nov 2015 16:57:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-question/m-p/957540#M328907</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-11-07T16:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Median question</title>
      <link>https://community.qlik.com/t5/QlikView/Median-question/m-p/957541#M328908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much swuehi and apologies for taking so long to confirm but I was away from my computer at the weekend.&lt;/P&gt;&lt;P&gt;Can I kindly ask if you can email me as I need to ask you something that is not directly related to this question and therefore not of interest to someone reading the thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Alexis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Nov 2015 00:46:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-question/m-p/957541#M328908</guid>
      <dc:creator>alexis</dc:creator>
      <dc:date>2015-11-09T00:46:25Z</dc:date>
    </item>
  </channel>
</rss>

