<?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: First Sorted Value based on average 12 month change in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732176#M452339</link>
    <description>&lt;P&gt;Brilliant! Thanks so much Kush.&amp;nbsp; Can I just ask, can I do the same, but in % terms for sorted values??&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jul 2020 15:45:29 GMT</pubDate>
    <dc:creator>jlampard40</dc:creator>
    <dc:date>2020-07-30T15:45:29Z</dc:date>
    <item>
      <title>First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732078#M452328</link>
      <description>&lt;P&gt;Hi - I want to produce a value which shows which medical examination has increased the most, in terms of activity, over the past 12 months.&amp;nbsp; So I need to calculate the average figure per month (over the past 12 months), then deduct it from the current month to get a positive or negative number.&amp;nbsp; We have thousands of exams and because of COVID we need to easily identify WHICH of the exams is changing the most as we are under pressure to cope now.&lt;/P&gt;&lt;P&gt;The dimension is called AD_ExamName&lt;/P&gt;&lt;P&gt;The data is sorted into months and the field is called AD_YearMonth&lt;/P&gt;&lt;P&gt;I then need to develop some set analysis which shows in a text box, which exam it is that has increased the most (AD_ExamName) from current month (AD_YearMonth='2020-07') against the past 12 months average...?&lt;/P&gt;&lt;P&gt;Thanks in advance for your help guys!&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:17:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732078#M452328</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2024-11-16T18:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732086#M452329</link>
      <description>&lt;P&gt;Would you be able to share sample data?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:09:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732086#M452329</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-30T13:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732091#M452330</link>
      <description>&lt;P&gt;This is a snapshot of the data we are using.&amp;nbsp; It's run daily, but we have 5 years worth of it (all in Excel spreadsheets).&amp;nbsp; We 'count' on AD_Event_Key as this is a unique value.&amp;nbsp; The AD_ExamName refers to the type of exam and you can see the various date fields we have towards the end of the columns.&amp;nbsp; As we are trying to compare an average of past 12 months against the current month of 2020-07 we'd need to work this out.&lt;/P&gt;&lt;P&gt;I would then like to show, in a text box, the VALUE of the AD_ExamName which is the largest difference (positive difference) from this month to the past average of 12 months gone.&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:21:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732091#M452330</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2020-07-30T13:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732107#M452331</link>
      <description>&lt;P&gt;Calculation will always be for current month or&amp;nbsp; it is dynamic? Like if you select any month then from that month to previous 12&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:45:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732107#M452331</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-30T13:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732109#M452332</link>
      <description>&lt;P&gt;Yes.&amp;nbsp; Calculation will always be for current month (2020-06) against the previous 12 months average.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:49:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732109#M452332</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2020-07-30T13:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732150#M452335</link>
      <description>&lt;P&gt;try below&lt;/P&gt;&lt;P&gt;First convert&amp;nbsp;&amp;nbsp;AD_YearMonth to proper Month Year format&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Data:
LOAD AD_Event_Key, 
     AD_ExamName, 
     AD_Modality, 
     AD_Urgency, 
     AD_FY, 
     AD_Q, 
     AD_CalYr, 
     date(date#(AD_YearMonth,'YYYY-MM'),'YYYY-MM') as AD_YearMonth,
     AD_FYWk
FROM
[QV Test 300720.xlsx]
(ooxml, embedded labels, table is Sheet1);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now you can use below expression in text object. Here my consideration is if you are in Jul-2020, previous 12 months will Jul-2019 to Jun-2020. i.e&amp;nbsp; excluding current month from previous 12 months&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;=FirstSortedValue(AD_ExamName, -aggr(count({&amp;lt;AD_YearMonth={"$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key)-avg(aggr(count({&amp;lt;AD_YearMonth={"&amp;gt;=$(=date(addmonths(max(AD_YearMonth),-12),'YYYY-MM'))&amp;lt;=$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key),AD_ExamName,AD_YearMonth)),AD_ExamName))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 15:48:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732150#M452335</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-30T15:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732176#M452339</link>
      <description>&lt;P&gt;Brilliant! Thanks so much Kush.&amp;nbsp; Can I just ask, can I do the same, but in % terms for sorted values??&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 15:45:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732176#M452339</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2020-07-30T15:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732179#M452340</link>
      <description>&lt;P&gt;Yes. You can use it. How % will be calculated?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 15:49:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732179#M452340</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-30T15:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732341#M452374</link>
      <description>&lt;P&gt;Hi Kush - using your methods above, I can now show which exams are showing the most and least change from previous month, compared to 12 month average.&amp;nbsp; However, I'd like to put this into perspective by also showing the % change, from previous month to past 12 months.&amp;nbsp; So, same methodology as your solution really, just showing it in % terms too.&lt;/P&gt;&lt;P&gt;Many thanks in advance Kush!&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 07:33:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732341#M452374</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2020-07-31T07:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732358#M452377</link>
      <description>&lt;P&gt;So % will be CurrentMonth/12Month avg?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 09:13:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732358#M452377</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-31T09:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732366#M452378</link>
      <description>&lt;P&gt;Yes Kush - expressed as a % change?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 09:23:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732366#M452378</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2020-07-31T09:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732375#M452380</link>
      <description>&lt;LI-CODE lang="javascript"&gt;may be this
=FirstSortedValue(num(aggr(count({&amp;lt;AD_YearMonth={"$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key)/
avg(aggr(count({&amp;lt;AD_YearMonth={"&amp;gt;=$(=date(addmonths(max(AD_YearMonth),-12),'YYYY-MM'))&amp;lt;=$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key),AD_ExamName,AD_YearMonth)),AD_ExamName),'#0.00%'), 

-aggr(count({&amp;lt;AD_YearMonth={"$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key)-
avg(aggr(count({&amp;lt;AD_YearMonth={"&amp;gt;=$(=date(addmonths(max(AD_YearMonth),-12),'YYYY-MM'))&amp;lt;=$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key),AD_ExamName,AD_YearMonth)),AD_ExamName))&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 31 Jul 2020 09:39:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732375#M452380</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-31T09:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732380#M452381</link>
      <description>&lt;P&gt;Hi Kush - that doesn't seem to work.&amp;nbsp; I just get a '-' where the exam name should be.&amp;nbsp; Any ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 09:59:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732380#M452381</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2020-07-31T09:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732394#M452383</link>
      <description>&lt;P&gt;Do you mean you want to show exam name based on highest %?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 10:32:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732394#M452383</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-31T10:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732395#M452384</link>
      <description>&lt;P&gt;Yes - % change, but to show highest change.&amp;nbsp; So like the - or + in front of Aggr statement, I would like to show the highest change and the lowest change.&amp;nbsp; Just by changing this symbol.&amp;nbsp; But I am lost with regards to the statement in the first place...!&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 10:34:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732395#M452384</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2020-07-31T10:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732396#M452385</link>
      <description>&lt;P&gt;try below.&amp;nbsp; Check which % change formula is correct.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Based on Current/Prev12MonthsAvg
=FirstSortedValue(AD_ExamName, 
-aggr(count({&amp;lt;AD_YearMonth={"$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key)/
avg(aggr(count({&amp;lt;AD_YearMonth={"&amp;gt;=$(=date(addmonths(max(AD_YearMonth),-12),'YYYY-MM'))&amp;lt;=$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key),AD_ExamName,AD_YearMonth)),AD_ExamName))

or

// Based on (Current-Prev12MonthsAvg)/Prev12MonthsAvg
=FirstSortedValue(AD_ExamName, 
-aggr((count({&amp;lt;AD_YearMonth={"$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key)-
avg(aggr(count({&amp;lt;AD_YearMonth={"&amp;gt;=$(=date(addmonths(max(AD_YearMonth),-12),'YYYY-MM'))&amp;lt;=$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key),AD_ExamName,AD_YearMonth)))/
avg(aggr(count({&amp;lt;AD_YearMonth={"&amp;gt;=$(=date(addmonths(max(AD_YearMonth),-12),'YYYY-MM'))&amp;lt;=$(=date(max(AD_YearMonth),'YYYY-MM'))"}&amp;gt;}AD_Event_Key),AD_ExamName,AD_YearMonth)),AD_ExamName))&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 31 Jul 2020 10:42:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732396#M452385</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-31T10:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732401#M452388</link>
      <description>&lt;P&gt;Hi Kush - I like the first one, works well.&amp;nbsp; But, it shows me the the highest or least positive change, using + or - in front of Aggr statement.&amp;nbsp; I have exams which have decreased and showing a decline - so how can I modify your code to show the highest declining exam in % terms??&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 10:58:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732401#M452388</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2020-07-31T10:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732403#M452389</link>
      <description>&lt;P&gt;Yes. Expression I used will show you based on highest % . If you want to show for lowest then you can simply remove '-' sign from second parameter of firstsortedvalue formula.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 11:05:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732403#M452389</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-31T11:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732406#M452390</link>
      <description>&lt;P&gt;Thanks Kush - it's showing the lowest positive change, but not the lowest change overall, which is -21%.&amp;nbsp; The change it's showing is +2% which IS the lowest POSITIVE change but not lowest change overall.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 11:10:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732406#M452390</guid>
      <dc:creator>jlampard40</dc:creator>
      <dc:date>2020-07-31T11:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: First Sorted Value based on average 12 month change</title>
      <link>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732412#M452391</link>
      <description>&lt;P&gt;We have used formula as Current/Prev12 Avg which will never give you negative difference as this is simply divide. Hence it will always return lowest positive % number.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you really want to calculate it based on % increase or % Decrease the you may need to change the formula&lt;/P&gt;&lt;P&gt;% Increase&amp;nbsp; - (Current - Prev12 Avg)/Prev12 Avg&lt;/P&gt;&lt;P&gt;% Decrease -&amp;nbsp; (Prev12 Avg-Current)/Prev12 Avg&lt;/P&gt;&lt;P&gt;Or let me know the logic of calculating % Increase &amp;amp; % Decrease so that we will be able to get desired output. But to be honest simple&amp;nbsp; % (Current/Prev12) is not gonna work here&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 11:32:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/First-Sorted-Value-based-on-average-12-month-change/m-p/1732412#M452391</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2020-07-31T11:32:00Z</dc:date>
    </item>
  </channel>
</rss>

