<?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 with Sum Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425799#M158600</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's just guessing around without knowing your setting, but in general, median() is an aggregation function like sum() or avg(), so you can apply set analysis also to median() [and you might need to]:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;=median( {1&amp;lt;IND = {'I'}&amp;gt;} aggr(sum( &lt;/SPAN&gt;{1&amp;lt;[IND] ={'I'}&amp;gt;} &lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;IM), [Exchange], Date ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Apr 2013 08:55:19 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2013-04-05T08:55:19Z</dc:date>
    <item>
      <title>Median with Sum Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425796#M158597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;So I have some values that I need to sum for each day and then extract median from all those sums. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;For example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;10 January&amp;nbsp; = sum(1 4 5 8 7 4 6) = 35&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;15 January = sum(5 4 8 9 1 ) = 27&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;16 January = sum( 5 4 8 1 2 ) = 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;median(all those sums) = 27&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;I tried doing this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;Median (sum(IM)) but it did not return any results &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;Any advice? I can create a table with all the dates and sums, maybe there is a way to use that column from the table for median? Really stuck here, thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;I also tried this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;median(aggr(sum(IM), [Exchange])))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;But it sums all the IM and I need to introduce Date field into this somehow to make sure it sums all IM for each date and then gets median from those sums&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 08:25:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425796#M158597</guid>
      <dc:creator />
      <dc:date>2013-04-05T08:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Median with Sum Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425797#M158598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;median(aggr(sum(IM), [Exchange])))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This approach should lead to the correct results, if you use the correct dimensions in your advanced aggregation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need to aggregate per Date, use Date as dimension:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;=median( aggr( sum(IM), Date) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure why you introduced Exchange field here, so you might need to to explain your data model a bit closer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general , you can use multiple dimensions to aggr() function, like in a table chart:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;=median(aggr(sum(IM), [Exchange], Date ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; color: #333333; font-size: 9pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 08:30:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425797#M158598</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-04-05T08:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Median with Sum Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425798#M158599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;brilliant, this seemed to work, thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have date field as i need to sum all IM per date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then exchange field, as i need to produce a chart to show IM for each exchange&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could you help me a bit more please as i need to introduce set analysis into this. I need to make sure that value I for IND is always selected and data doesn't change if the user selects smth else, in other words, this selection should be fixed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;=median(aggr(sum( &lt;/SPAN&gt;{1&amp;lt;[IND] ={'I'}&amp;gt;} &lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;IM), [Exchange], Date ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;but then the results get messed up, did i put it in the right place and did i use the correct syntax? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 08:41:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425798#M158599</guid>
      <dc:creator />
      <dc:date>2013-04-05T08:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Median with Sum Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425799#M158600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's just guessing around without knowing your setting, but in general, median() is an aggregation function like sum() or avg(), so you can apply set analysis also to median() [and you might need to]:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;=median( {1&amp;lt;IND = {'I'}&amp;gt;} aggr(sum( &lt;/SPAN&gt;{1&amp;lt;[IND] ={'I'}&amp;gt;} &lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;IM), [Exchange], Date ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 08:55:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425799#M158600</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-04-05T08:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Median with Sum Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425800#M158601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if i do this then the field gets fixed but so does the exchange so it shows median for all the exchanges and it they should change depending on user selection&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the user selects company A, it should show medians for each exchange applicable to that company only&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the user selects a different company, the medians and exchanges should change accordingly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at the moment it shows all the possible exchanges and medians overall for all the firms and if a different firm gets chosen, it just stays the same&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i also tried this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;=median( {1&amp;lt;IND = {'I'}&amp;gt;} aggr(sum(&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;IM), [Exchange], Date ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;but the chart just stays the same and reacts if IND field is changed&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 09:06:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425800#M158601</guid>
      <dc:creator />
      <dc:date>2013-04-05T09:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Median with Sum Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425801#M158602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's because you are using set identifier 1 in your set analysis, try the default set:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;=median( {$&amp;lt;IND = {'I'}&amp;gt;} aggr(sum( &lt;/SPAN&gt;{$&amp;lt;[IND] ={'I'}&amp;gt;} &lt;SPAN style="font-family: 'Arial', 'sans-serif'; color: #333333; font-size: 9pt;"&gt;IM), [Exchange], Date ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 09:09:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425801#M158602</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-04-05T09:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Median with Sum Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425802#M158603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Genius&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 09:12:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Median-with-Sum-Expression/m-p/425802#M158603</guid>
      <dc:creator />
      <dc:date>2013-04-05T09:12:53Z</dc:date>
    </item>
  </channel>
</rss>

