<?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: Set Analysis to check previous values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899736#M1011202</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Toni,&lt;/P&gt;&lt;P&gt;So the idea is when ABC has a value of 345, I don't have to sum up the GP in Jun2015 for ABC.&lt;/P&gt;&lt;P&gt;If ABC has 0 value in Variable3, then I should sum the GP in the selected month.&lt;/P&gt;&lt;P&gt;I am not sure if assigning the calculation to _OH_Code will correctly return the result i want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly, if I can get this working, i will then try to do a similar check for FS_TL_ID (If no values in Variable3, then sum all GP for FS_TL_ID).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy to hear any better way of doing this. I'm just stuck &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Apr 2015 22:04:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-04-28T22:04:26Z</dc:date>
    <item>
      <title>Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899727#M1011193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="EN-AU" style="color: #1f497d;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-AU" style="color: #1f497d;"&gt;Need some help with my set analysis logic.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-AU" style="color: #1f497d;"&gt;1. I'm trying to determine if a customer is a new customer based on this condition:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-AU" style="color: #1f497d;"&gt;a) &lt;/SPAN&gt;&lt;SPAN lang="EN-AU" style="color: #1f497d;"&gt; customer has no transaction from the last 6 months from selected period. Example, Customer ABC; select Jun2015. Check from Dec2014 to May2015 for any Sales for this customer. If no sales, then sum the sales in Jun 2015 else return 0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum({$&amp;lt; _OH_Code = {"=sum({$&amp;lt;MC_Period=, MC_Year=, MC_Quarter=, MC_Week=, MC_Date = {'&amp;gt;$(=MonthEnd(addmonths(max(MC_Date),-7)))&amp;lt;=$(=MonthEnd(addmonths(max(MC_Date),-1)))'}&amp;gt;}GP) = 0"} &amp;gt;} GP)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-size: 10pt; line-height: 1.5em;"&gt;However, nothing is being summed up. What is wrong with the above syntax?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Any feedback much appreciated. thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 07:15:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899727#M1011193</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-24T07:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899728#M1011194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if(sum({&amp;lt;MC_Date ={'&amp;gt;$(=MonthEnd(addmonths(max(MC_Date),-7)))&amp;lt;=$(=MonthEnd(addmonths(max(MC_Date),-1)))'}&amp;gt;}GP)=0,sum(GP),0)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 07:54:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899728#M1011194</guid>
      <dc:creator>ankitaag</dc:creator>
      <dc:date>2015-04-24T07:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899729#M1011195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks, Ankita. Is there any way to do purely using Set Analysis?&lt;/P&gt;&lt;P&gt;This is because i need to use this formula to then calculate if FS_TL_ID exists in the past 6 months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;MC_Date=,&lt;/P&gt;&lt;P&gt;FS_TL_ID= {"=sum({$&amp;lt;MC_Period=, MC_Year=, MC_Quarter=, MC_Week=, MC_Date = {'&amp;gt;$(=MonthEnd(addmonths(max(MC_Date),-7)))&amp;lt;=$(=MonthEnd(addmonths(max(MC_Date),-1)))'}&amp;gt;}GP) = 0"}&amp;gt;}GP)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have tried using IF conditions, but it will not work without the FS_TL_ID added as a dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Derrell&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 23:11:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899729#M1011195</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-24T23:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899730#M1011196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for new and lost customer there is a detailed post here (add dot)&lt;/P&gt;&lt;P&gt;poverconsulting com/2014/03/04/set-analysis-nested-advanced-search/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Apr 2015 15:03:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899730#M1011196</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-04-25T15:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899731#M1011197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The main reason to the set expression not working as you intended is likely that the syntax is incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first thing that I notice in your example is that you are trying to apply an expression as the set modifier, and not the calculated result from the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the below example the the set modifier applies a selection in field &lt;SPAN style="font-size: 13.3333330154419px;"&gt;_OH_Code that is equal to the text &lt;SPAN style="font-size: 13.3333330154419px;"&gt;"=sum(GP) = 0". &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;sum({$&amp;lt;_OH_Code = {"=sum(GP) = 0"} &amp;gt;} GP)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;In the below example the expression is calculated and the result is expanded in to the expression through the dollar expansion. The equal sign in the dollar expansion means that QlikView will&amp;nbsp; evaluate the following expression.&amp;nbsp; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;sum({$&amp;lt;_OH_Code = {"$(=sum(GP) = 0)"} &amp;gt;} GP)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second thing that I think will could cause you problems in this example is the MonthEnd() expansion. Notice that this will also be calculated as a expression total, and will also be evaluated before the chart expression is calculated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;$(=MonthEnd(addmonths(max(MC_Date),-1)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My suggestion is that you create four variables in the application to represent your calculations, and then evaluate if the results are expected in the context of expanding them in the chart expression. I think this will give you a better overview of what is actually being used int he chart expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Variabel1 = &lt;SPAN style="font-size: 13.3333330154419px;"&gt;MonthEnd(addmonths(max(MC_Date),-7))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Variable2 &lt;SPAN style="font-size: 13.3333330154419px;"&gt;= MonthEnd(addmonths(max(MC_Date),-1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable3 = &lt;SPAN style="font-size: 13.3333330154419px;"&gt;sum({$&amp;lt;MC_Period=, MC_Year=, MC_Quarter=, MC_Week=, MC_Date = {"&amp;gt;$(Variable1)&amp;lt;=$(Variable2)"}&amp;gt;}GP)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable4 = $(Variable3)=0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will leave you with a chart expression that only contains the Variable4, and it is not easier to see that the same expression will be used on each dimension value in the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chart Expressions = sum({$&amp;lt;_OH_Code = {"$(Variable4)"} &amp;gt;} GP)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To summarize the set expression can not be dynamically altered from row to row in your chart. If this is what you are trying to do, I hope the above example helps to explain how the &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;setexpression and dollar expansion works. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2015 05:10:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899731#M1011197</guid>
      <dc:creator>ToniKautto</dc:creator>
      <dc:date>2015-04-26T05:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899732#M1011198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Toni,&lt;/P&gt;&lt;P&gt;Thanks for helping,&lt;/P&gt;&lt;P&gt;I've tried to apply your suggestions and i did noticed that Variable3 may have a syntax error even though QV expression says "OK".&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Variable3.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/85189_Variable3.png" style="height: 52px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;should the variable3 expression be like this?&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;MC_Period=, MC_Year=, MC_Quarter=, MC_Week=, MC_Date = {"&amp;gt;$(Variable1)&amp;lt;=$(Variable2)"}&amp;gt;}GP)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Derrell&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 21:45:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899732#M1011198</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-27T21:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899733#M1011199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct. Sorry about the copy paste mistake I made there, it has been corrected in the previous post. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 04:06:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899733#M1011199</guid>
      <dc:creator>ToniKautto</dc:creator>
      <dc:date>2015-04-28T04:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899734#M1011200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Toni. i am still struggling...&lt;/P&gt;&lt;P&gt;I've got this far -&amp;gt; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #f2f2f2;"&gt;Chart Expressions = sum({$&amp;lt;_OH_Code = {"$(Variable4)"} &amp;gt;} GP)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #f2f2f2;"&gt;it looks like it is pulling all the dates correctly; but in the table i get a '-'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #f2f2f2;"&gt;it looks like it is unable to display the expression. any ideas why this could be the reason?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Variable4.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/85197_Variable4.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 04:43:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899734#M1011200</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-28T04:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899735#M1011201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Your variables are no defined as below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2015-04-28 15_26_49-QlikView x64 - [C__Users_tko_Downloads_newsalesTest_help (1).qvw_].png" class="jive-image image-1" src="/legacyfs/online/85200_2015-04-28 15_26_49-QlikView x64 - [C__Users_tko_Downloads_newsalesTest_help (1).qvw_].png" style="height: 58px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;In your initial question you referred to Jun 2015 being the selected MC_Period, which will give you the following result in the variables.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2015-04-28 15_57_34-QlikView x64 - [C__Users_tko_Downloads_newsalesTest_help (1).qvw_].png" class="jive-image image-2" src="/legacyfs/online/85201_2015-04-28 15_57_34-QlikView x64 - [C__Users_tko_Downloads_newsalesTest_help (1).qvw_].png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Effectively this means that the expression in Variable3 will look be a set expression limited by the Variable1 and Varibale2 dates, just as shown below. If you place this expression in your straight table you will see that the ABC line returns 0, this is an indication of the ABC row having no records or a zero value record. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;=Sum({$&amp;lt;MC_Period=, MC_Year=, MC_Quarter=, MC_Week=, MC_Date = {"&amp;gt;30/11/2014&amp;lt;=31/05/2015"}&amp;gt;}GP)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you instead use Count() you will be able to confirm that there is no record associated with the set expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;=Count({$&amp;lt;MC_Period=, MC_Year=, MC_Quarter=, MC_Week=, MC_Date = {"&amp;gt;30/11/2014&amp;lt;=31/05/2015"}&amp;gt;}GP)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I suspect that a bigger problem might be that Variable4 will be based on the expression total of Variable3, meaning that Variable4 willbe calculated as 345=0 at all times and not as a row by row value. Correct me if I am wrong, but I think you are trying to compare the ABC value with 0 and not the expression total of 345?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 10:35:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899735#M1011201</guid>
      <dc:creator>ToniKautto</dc:creator>
      <dc:date>2015-04-28T10:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis to check previous values</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899736#M1011202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Toni,&lt;/P&gt;&lt;P&gt;So the idea is when ABC has a value of 345, I don't have to sum up the GP in Jun2015 for ABC.&lt;/P&gt;&lt;P&gt;If ABC has 0 value in Variable3, then I should sum the GP in the selected month.&lt;/P&gt;&lt;P&gt;I am not sure if assigning the calculation to _OH_Code will correctly return the result i want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly, if I can get this working, i will then try to do a similar check for FS_TL_ID (If no values in Variable3, then sum all GP for FS_TL_ID).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy to hear any better way of doing this. I'm just stuck &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 22:04:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-to-check-previous-values/m-p/899736#M1011202</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-28T22:04:26Z</dc:date>
    </item>
  </channel>
</rss>

