<?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: Weighted median in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963970#M330601</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use repeat() in the script as well.&lt;/P&gt;&lt;P&gt;I tested your example data. Here's the result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_184641_Pic3.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/100425_QlikCommunity_Thread_184641_Pic3.JPG" style="height: 269px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Qlik on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Sep 2015 22:33:06 GMT</pubDate>
    <dc:creator>MarcoWedel</dc:creator>
    <dc:date>2015-09-29T22:33:06Z</dc:date>
    <item>
      <title>Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963962#M330593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone suggest the best way to calculated a weighted median in QlikView&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data i have is in the following format. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;Value, Weight&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;2, 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;7, 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;9, 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;13, 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;The weighted median is 7 as illustrated below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;2 2 2 7 7 7 7 &lt;/SPAN&gt;&lt;STRONG style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;7&lt;/STRONG&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt; 9 9 9 9 9 13 13&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;Can anyone think of the best way to calculated this in QlikView?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #505050; font-family: arial, helvetica, clean, sans-serif; font-size: 14.079px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 20:37:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963962#M330593</guid>
      <dc:creator>mjamesking</dc:creator>
      <dc:date>2015-09-29T20:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963963#M330594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you need to use Median function.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class="Bold"&gt;&lt;EM&gt;median (&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class="Italic"&gt;[{set_expression}] [ &lt;SPAN class="Bold"&gt;distinct&lt;/SPAN&gt; ] [ &lt;SPAN class="Bold"&gt;total&lt;/SPAN&gt; [&amp;lt;fld {,fld}&amp;gt;] ] expression &lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt; &lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Median([Value])&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ely&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 21:10:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963963#M330594</guid>
      <dc:creator>elyM</dc:creator>
      <dc:date>2015-09-29T21:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963964#M330595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ely, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But that won't take the weight into account, the weighted median is 7, just doing median of Value gives me 8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 21:20:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963964#M330595</guid>
      <dc:creator>mjamesking</dc:creator>
      <dc:date>2015-09-29T21:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963965#M330596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;I have created a new QlikView document with your list of value, 15 not distinct values in field.&lt;/P&gt;&lt;P&gt;Check&amp;nbsp; return number of this function &lt;STRONG&gt;Count([Value])&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ely&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 21:32:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963965#M330596</guid>
      <dc:creator>elyM</dc:creator>
      <dc:date>2015-09-29T21:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963966#M330597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank Ely - I have the same here with the expanded list, I was wondering if there if there was a way of using the two fields in my data &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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;Value, Weight&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;2, 3&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;7, 5&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;9, 5&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;13, 2&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;to come up with the same answer in one expression. Or whether (as you and I have done) I need to first expand the data?&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;If the only way to do this is to expand the data into the list of 15 values can you think of a quick way of doing this in a script without looping through the list with peek, which would be very slow with high data volumes. Also the weight my not necessarily be a whole number in every scenario that we may want to use this?&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;Matt&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 21:40:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963966#M330597</guid>
      <dc:creator>mjamesking</dc:creator>
      <dc:date>2015-09-29T21:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963967#M330598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Value, Weight&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;7, 5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;13, 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;9, 5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NewTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; RangeSum(Weight, Peek('CumWeight')) as CumWeight&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By Value;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vTotalWeight = Peek('CumWeight');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vMedian1 = If(Odd($(vTotalWeight)), Ceil($(vTotalWeight)/2), $(vTotalWeight)/2);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vMedian2 = If(Odd($(vTotalWeight)), Ceil($(vTotalWeight)/2), ($(vTotalWeight)/2 + 1));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Temp1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Value as Value1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Weight&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident NewTable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where CumWeight &amp;lt;= $(vMedian1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vMedianValue1 = Peek('Value1');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Temp2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Value as Value2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Weight&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident NewTable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where CumWeight &amp;lt;= $(vMedian2);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vMedianValue2 = Peek('Value2');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Tables Temp1, Temp2, Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vMedian = ($(vMedianValue1) + $(vMedianValue2))/2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The median value is saved in the variable vMedian.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable Overview:&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/100399_Capture.PNG" style="max-width: 620px; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the data is changed so that the sum of weight is 14 and the median will be the average of 7th observation and 8th observation you get the following result -&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/100421_Capture.PNG" style="height: 178px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 22:03:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963967#M330598</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-09-29T22:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963968#M330599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one solution could be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14435644353695905 jive_text_macro" jivemacro_uid="_14435644353695905"&gt;
&lt;P&gt;RangeFractile(0.5,$(=Left(Concat(Repeat(Value&amp;amp;',',Weight)),Len(Concat(Repeat(Value&amp;amp;',',Weight)))-1)))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_184641_Pic1.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/100402_QlikCommunity_Thread_184641_Pic1.JPG" style="height: 162px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_184641_Pic2.JPG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/100424_QlikCommunity_Thread_184641_Pic2.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 22:10:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963968#M330599</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-09-29T22:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963969#M330600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Marco this is an amazing way to handle this. I have never used the repeat function before and was thinking of something like this in script. Is there a repeat equivalent of something in script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I am unable to open your attached qvw because I am using the PE, but can you check what is the median if this the data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * Inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Value, Weight&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2, 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;7, 5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;13, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;9, 5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would expect it to be 4.5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 22:15:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963969#M330600</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-09-29T22:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963970#M330601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use repeat() in the script as well.&lt;/P&gt;&lt;P&gt;I tested your example data. Here's the result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_184641_Pic3.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/100425_QlikCommunity_Thread_184641_Pic3.JPG" style="height: 269px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Qlik on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 22:33:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963970#M330601</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-09-29T22:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963971#M330602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's a great way to do it. Could you see this scaling with a lot of rows, or becoming slow? Also if the weights given aren't whole numbers, but numbers to a few decimal places can you think of a way to perform an equivalent calculation?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 22:33:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963971#M330602</guid>
      <dc:creator>mjamesking</dc:creator>
      <dc:date>2015-09-29T22:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963972#M330603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the script implementation I had something in mind like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_184641_Pic4.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/100426_QlikCommunity_Thread_184641_Pic4.JPG" style="height: auto;" /&gt;&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_14435663848084564" jivemacro_uid="_14435663848084564"&gt;
&lt;P&gt;LOAD Median(Value) as YourMedian;&lt;/P&gt;
&lt;P&gt;LOAD Value&lt;/P&gt;
&lt;P&gt;INLINE [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value, Weight&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7, 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13, 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9, 5&lt;/P&gt;
&lt;P&gt;]&lt;/P&gt;
&lt;P&gt;While IterNo()&amp;lt;=Weight;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 22:40:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963972#M330603</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-09-29T22:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963973#M330604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I don't like my solution anymore. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for sharing the script solution. I will have to spend some more time understanding how IterNo() works. I have thought about using it, but never really put time to see what it is doing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Marco.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 22:47:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963973#M330604</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-09-29T22:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963974#M330605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;try this quick&amp;nbsp; backend solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="dp-highlighter"&gt;&lt;DIV class="bar"&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;OL class="dp-c" start="1"&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;Test:&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;NoConcatenate&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;Load&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;Value&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;,Weight&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;While&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;(Weight - IterNo())&amp;gt;=0;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;Load&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;*&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;INLINE [&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;Value,Weight&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;2,3&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;7,5&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;9,5&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI class="alt"&gt;&lt;SPAN&gt; &lt;SPAN&gt;13,2];&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 15:12:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963974#M330605</guid>
      <dc:creator>elyM</dc:creator>
      <dc:date>2015-09-30T15:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963975#M330606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is, great. I'm getting there &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, let me change the question slightly. If instead of an integer for weight, I'm given a decimal or a percentage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;So, data look like this:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;Value, Weight&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;2, 0.2&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;7, 0.333333&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;9, 0.333333&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;13, 0.133333&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;How to tackle this? Both the solutions above the the expression and the iterative load are great, but rely on whole numbers. &lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;Thanks&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;Matt&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&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="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 18:20:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963975#M330606</guid>
      <dc:creator>mjamesking</dc:creator>
      <dc:date>2015-09-30T18:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963976#M330607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;first idea is to bring all Weight occurrences and calculate &lt;STRONG&gt;GCD &lt;/STRONG&gt;(greatest common divisor) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0.2 = 1/5 -&amp;gt;3&lt;/P&gt;&lt;P&gt;0.3333= 1/3 -&amp;gt; 5&lt;/P&gt;&lt;P&gt;0.1333 = 2/15 -&amp;gt; 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;beacuse GCD is 15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Value,&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;&lt;STRONG&gt;Weight&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;2,3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;7,5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;9,5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 14.079px; font-family: arial, helvetica, clean, sans-serif; color: #505050;"&gt;13,2&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ely&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 07:52:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963976#M330607</guid>
      <dc:creator>elyM</dc:creator>
      <dc:date>2015-10-01T07:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963977#M330608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ely,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now have the data - and as I expected I receive the weights as a percentage, not a whole number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I now want to do is to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Order the list of values by value, and calculate the cumulative weight. Highlight the first value where the cumulative weight reaches over 50% of the total weight for the data set (this is the weighted median). Very much like how Sunny did this in the script, but I would like to do this as part of a straight table - or more ideally have a formula that returns the value straight off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have this straight table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Weighted Median.PNG" class="jive-image image-1" src="/legacyfs/online/100816_Weighted Median.PNG" style="height: 153px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ordering the values by value, using the following formula to calculate the running total&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running Weight: =Rangesum(Above(TOTAL Sum(Weight),0,rowno(TOTAL)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 50% threshold, Median Threshold:&amp;nbsp; =SUM(TOTAL Weight)/2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And a simple IF statement to highlight where the Running weight is greater than the threshold.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I would like to highlight the the first row where the threshold is broken (in this case Value = 7). &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking I need an AGGR expression and to use FirstSortedValue, but cannot get anything to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate everyone's help, thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2015 16:54:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963977#M330608</guid>
      <dc:creator>mjamesking</dc:creator>
      <dc:date>2015-10-02T16:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963978#M330609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maybe using a background colour expression like:&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_14439118082037839" jivemacro_uid="_14439118082037839"&gt;
&lt;P&gt;=If(Rangesum(Above(Weight,0,RowNo()))/Sum(TOTAL Weight)&amp;gt;=0.5 and Rangesum(Above(Weight,1,RowNo()-1))/Sum(TOTAL Weight)&amp;lt;0.5,Yellow())&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_184641_Pic5.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/100872_QlikCommunity_Thread_184641_Pic5.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_184641_Pic6.JPG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/100873_QlikCommunity_Thread_184641_Pic6.JPG" style="height: 230px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Oct 2015 22:37:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963978#M330609</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-10-03T22:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963979#M330610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Marco &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That gives me the chart I was after. Great. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts on how to just get the answer in an expression, without the need for a straight table? Some kind of aggr function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matt &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Oct 2015 23:24:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963979#M330610</guid>
      <dc:creator>mjamesking</dc:creator>
      <dc:date>2015-10-03T23:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963980#M330611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maybe like:&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_14439151123271547" jivemacro_uid="_14439151123271547"&gt;
&lt;P&gt;Aggr(If(Rangesum(Above(Weight,0,RowNo()))/Sum(TOTAL Weight)&amp;gt;=0.5 and Rangesum(Above(Weight,1,RowNo()-1))/Sum(TOTAL Weight)&amp;lt;0.5,Value),Value)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_184641_Pic7.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/100878_QlikCommunity_Thread_184641_Pic7.JPG" style="height: 55px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps as well&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 Oct 2015 23:31:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963980#M330611</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-10-03T23:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted median</title>
      <link>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963981#M330612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for everyone's help, all answers very useful. One thing to be aware of especially with the final aggregation is order that the data is loaded into qlikview, the original order is what's important here, not any subsequent sorting in the script. I had to fool qlikview by renaming fields after sorting to get consistent sensible answers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2015 05:04:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Weighted-median/m-p/963981#M330612</guid>
      <dc:creator>mjamesking</dc:creator>
      <dc:date>2015-10-07T05:04:40Z</dc:date>
    </item>
  </channel>
</rss>

