<?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 with if statement and getfieldselection in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-analysis-with-if-statement-and-getfieldselection/m-p/447994#M167191</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;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;Date = {'&amp;gt;=$(=MonthStart(AddMonths(Max(Date),-1)))&amp;lt;=$(=MonthEnd(AddMonths(Max(Date),-1)))'},detailYear=,detailMonth=&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Dec 2012 15:26:13 GMT</pubDate>
    <dc:creator>MayilVahanan</dc:creator>
    <dc:date>2012-12-18T15:26:13Z</dc:date>
    <item>
      <title>Set analysis with if statement and getfieldselection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-with-if-statement-and-getfieldselection/m-p/447993#M167190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I apologize, I'm still learning set analysis.&amp;nbsp; We have a field that is calculating the prior month units based on the year/month selected.&amp;nbsp; Unfortunately this doesn't work when January is selected as the months are numeric so it sees month 1 and then subtracts 1 to get prior month, which doesn't work as there is no month zero.&amp;nbsp; I need to modify the following formula to include if statements for both the year and the month.&amp;nbsp; If the dteailmonth is &amp;gt;1 then use the detailmonth, else use detailmonth 12.&amp;nbsp; And if the detailmonth=1 then the year needs to be detailyear-1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how I can modify this to accomodate those if statements?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;sum&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;detailmonth&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"$(=GetFieldSelections(detailmonth)-1)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;},&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;detailyear&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"$(=GetFieldSelections(detailyear))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;} &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style=": ; color: #0000ff; font-size: 8pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;Thanks in advance!!~ Rebecca&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 15:08:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-with-if-statement-and-getfieldselection/m-p/447993#M167190</guid>
      <dc:creator />
      <dc:date>2012-12-18T15:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with if statement and getfieldselection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-with-if-statement-and-getfieldselection/m-p/447994#M167191</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;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;Date = {'&amp;gt;=$(=MonthStart(AddMonths(Max(Date),-1)))&amp;lt;=$(=MonthEnd(AddMonths(Max(Date),-1)))'},detailYear=,detailMonth=&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 15:26:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-with-if-statement-and-getfieldselection/m-p/447994#M167191</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2012-12-18T15:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with if statement and getfieldselection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-with-if-statement-and-getfieldselection/m-p/447995#M167192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That doesn't quite work.&amp;nbsp; I think it's because my data coming in is already parsed into months 1-12, and years.&amp;nbsp; I don't actually have a Date field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 15:38:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-with-if-statement-and-getfieldselection/m-p/447995#M167192</guid>
      <dc:creator />
      <dc:date>2012-12-18T15:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with if statement and getfieldselection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-with-if-statement-and-getfieldselection/m-p/447996#M167193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ended up doing this and it seems to be working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;detailmonth&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;gt;1,&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;detailmonth&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"$(=GetFieldSelections(detailmonth)-1)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;},&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;detailyear&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"$(=GetFieldSelections(detailyear))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;} &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;detailmonth&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={12},&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;detailyear&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"$(=GetFieldSelections(detailyear)-1)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;} &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;units&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 16:56:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-with-if-statement-and-getfieldselection/m-p/447996#M167193</guid>
      <dc:creator />
      <dc:date>2012-12-18T16:56:48Z</dc:date>
    </item>
  </channel>
</rss>

