<?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: how to write this expression in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783414#M664770</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Thanks for your reply&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;But the actual expression is &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;=AGGR(NUM(RANK(SUM({&amp;lt;R6={'C'},[Organization Name]=,[Organization ID]=,[Organization Name|ID]=,[Sold To Opt Out Flag]={'N'}&amp;gt;}[Monthly Sales]), 4, 1)),[Organization Name|ID])&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;the above is the script i am trying to do in script editor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Feb 2015 07:00:05 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-02-11T07:00:05Z</dc:date>
    <item>
      <title>how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783409#M664765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;=SUM({&amp;lt;R3={'C'},[Sold To Opt Out Flag]={'N'}&amp;gt;}TOTAL &amp;lt;[Territory Name]&amp;gt; [Monthly Sales]&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 05:47:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783409#M664765</guid>
      <dc:creator />
      <dc:date>2015-02-11T05:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783410#M664766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if(&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;R3='C' and [Sold To Opt Out Flag]='N'&lt;/STRONG&gt;,Aggr(sum(&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Monthly Sales]),&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Territory Name]&lt;/STRONG&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 06:23:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783410#M664766</guid>
      <dc:creator>avinashelite</dc:creator>
      <dc:date>2015-02-11T06:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783411#M664767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it working in script editor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 06:37:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783411#M664767</guid>
      <dc:creator />
      <dc:date>2015-02-11T06:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783412#M664768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load &lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Territory Name],&lt;/STRONG&gt;SUM([Monthly Sales])&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Where R3='C' and [Sold To Opt Out Flag]='N'&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Group by &lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Territory Name]&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 06:48:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783412#M664768</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2015-02-11T06:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783413#M664769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you want&amp;nbsp; the sum then you need to create a resident load and use the group by function &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 06:53:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783413#M664769</guid>
      <dc:creator>avinashelite</dc:creator>
      <dc:date>2015-02-11T06:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783414#M664770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Thanks for your reply&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;But the actual expression is &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;=AGGR(NUM(RANK(SUM({&amp;lt;R6={'C'},[Organization Name]=,[Organization ID]=,[Organization Name|ID]=,[Sold To Opt Out Flag]={'N'}&amp;gt;}[Monthly Sales]), 4, 1)),[Organization Name|ID])&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;the above is the script i am trying to do in script editor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 07:00:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783414#M664770</guid>
      <dc:creator />
      <dc:date>2015-02-11T07:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783415#M664771</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;set analysis wont work in the script . Please follow the anbu approach &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 07:10:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783415#M664771</guid>
      <dc:creator>avinashelite</dc:creator>
      <dc:date>2015-02-11T07:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783416#M664772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ,how to use rank function in load statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 07:12:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783416#M664772</guid>
      <dc:creator />
      <dc:date>2015-02-11T07:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783417#M664773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Temp:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load [Territory Name],SUM([Monthly Sales]) MonthlySales&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Resident Table&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Where R3='C' and [Sold To Opt Out Flag]='N'&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Group by [Territory Name]&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Rank:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load *,RowNo() As Rank Resident Temp Order by &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;MonthlySales desc&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 07:30:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783417#M664773</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2015-02-11T07:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783418#M664774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for reply anbu will apply n let u know&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 08:14:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783418#M664774</guid>
      <dc:creator />
      <dc:date>2015-02-11T08:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783419#M664775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi anbu ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is not working it shows invaid expression&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 08:29:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783419#M664775</guid>
      <dc:creator />
      <dc:date>2015-02-11T08:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783420#M664776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post what you tried? On which line you got error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 08:34:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783420#M664776</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2015-02-11T08:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783421#M664777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me tell you clealy forget about rank now,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;expression in chart,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM({&amp;lt;R3={'C'}&amp;gt;}[Monthly Sales])&lt;/P&gt;&lt;P&gt;/SUM({&amp;lt;R3={'C'}&amp;gt;}TOTAL &amp;lt;[Territory Name]&amp;gt; [Monthly Sales])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above expression i have to write in script editor&lt;/P&gt;&lt;P&gt;FYI,&lt;/P&gt;&lt;P&gt;R3=RC_R3_C&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;RC_R3_C=sum(monthly sales)&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;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 08:38:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783421#M664777</guid>
      <dc:creator />
      <dc:date>2015-02-11T08:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783422#M664778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post entire script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 09:18:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783422#M664778</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2015-02-11T09:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783423#M664779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;//sundars4 - added as part of FCR Project &lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;Fact_Table:&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;resident &lt;/P&gt;&lt;P&gt;Fact&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Limit Fact Table to drop competitors.&lt;/P&gt;&lt;P&gt;left join (Fact_Table)&lt;/P&gt;&lt;P&gt;load Distinct&lt;/P&gt;&lt;P&gt;[Brand Code],&lt;/P&gt;&lt;P&gt;[Competitor Flag]&lt;/P&gt;&lt;P&gt;resident&lt;/P&gt;&lt;P&gt;[Brand]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Left Join Fact Table with [Sold To Customer] Table with key as _FF|CUST|ADDR, to get [Sold To Opt Out Flag] flags in the Fact Table.&lt;/P&gt;&lt;P&gt;// Sold To Opt Out Fact Records will be dropped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join (Fact_Table)&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;_FF|CUST|ADDR,&lt;/P&gt;&lt;P&gt;[Sold To Opt Out Flag],&lt;/P&gt;&lt;P&gt;[Organization Name]&lt;/P&gt;&lt;P&gt;resident&lt;/P&gt;&lt;P&gt;[Sold To Customer];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Left Join Fact Table with [Date-Month] Table with key as Month-Year, to get CM,CQ,CHY,R3,R6,R12,R3YOY,R6YOY,YTDYOY flags, &lt;/P&gt;&lt;P&gt;// These Flags used to identify the current month,current quarter,current semester,rolling current quarter,rolling previous quarter,&lt;/P&gt;&lt;P&gt;// rolling current semester,rolling previous semester, rolling current year,rolling previous year,yoy current quarter,yoy previous quarter,&lt;/P&gt;&lt;P&gt;// yoy current semester,yoy previous semester,yoy current year and yoy previous year Fact Records for further rollup.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join (Fact_Table)&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;resident&lt;/P&gt;&lt;P&gt;[Date-Month];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Summarize Fact Table at Brand Code, _CURR_TERR_DIM_ID Level and get Current Month,Current Quarter,Current Semester PTP Metrics,&lt;/P&gt;&lt;P&gt;// Rolling 3 months,6 months, 12 Months metrics&lt;/P&gt;&lt;P&gt;// YOY 3 months,6 months and 12 Months metrics&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;[Brand Code],&lt;/P&gt;&lt;P&gt;_CURR_TERR_DIM_ID,&lt;/P&gt;&lt;P&gt;[Competitor Flag],&lt;/P&gt;&lt;P&gt;//[Organization Name],&lt;/P&gt;&lt;P&gt;Sum(IF(R3='C',[Monthly Sales])) as RG_R3_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R3='P',[Monthly Sales])) as RG_R3_P,&lt;/P&gt;&lt;P&gt;Sum(IF(R6='C',[Monthly Sales])) as RG_R6_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R6='P',[Monthly Sales])) as RG_R6_P,&lt;/P&gt;&lt;P&gt;Sum(IF(R12='C',[Monthly Sales])) as RG_R12_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R12='P',[Monthly Sales])) as RG_R12_P,&lt;/P&gt;&lt;P&gt;Sum(IF(R3='C',[Monthly Sales])) as RC_R3_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R3='C',[Monthly Sales])) as RV_R3_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R6='C',[Monthly Sales])) as RV_R6_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R12='C',[Monthly Sales])) as RV_R12_C,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Sum(IF(R3='C',[Competitor Flag] = 'N',[Monthly Sales])) as CM_R3_C,&lt;/P&gt;&lt;P&gt;//Sum(IF(R3='P',[Competitor Flag] = 'N',[Monthly Sales])) as CM_R3_P,&lt;/P&gt;&lt;P&gt;Sum(IF(R6='C' and [Competitor Flag]='N' ,[Monthly Sales])) as CM_R6_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R6='P' and [Competitor Flag]='N',[Monthly Sales])) as CM_R6_P,&lt;/P&gt;&lt;P&gt;//Sum(IF(R12='C',[Competitor Flag] = 'N',[Monthly Sales])) as CM_R12_C,&lt;/P&gt;&lt;P&gt;//Sum(IF(R12='P',[Competitor Flag] = 'N',[Monthly Sales])) as CM_R12_P,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Sum(IF(R3='C',[Competitor Flag] &amp;lt;&amp;gt; 'N',[Monthly Competitor Sales])) as CMC_R3_C,&lt;/P&gt;&lt;P&gt;//Sum(IF(R3='P',[Competitor Flag] &amp;lt;&amp;gt; 'N',[Monthly Competitor Sales])) as CMC_R3_P,&lt;/P&gt;&lt;P&gt;Sum(IF(R6='C' and [Competitor Flag]='Y',[Monthly Competitor Sales])) as CMC_R6_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R6='P' and [Competitor Flag]='Y',[Monthly Competitor Sales])) as CMC_R6_P,&lt;/P&gt;&lt;P&gt;//Sum(IF(R12='C',[Competitor Flag] &amp;lt;&amp;gt; 'N',[Monthly Competitor Sales])) as CMC_R12_C,&lt;/P&gt;&lt;P&gt;//Sum(IF(R12='P',[Competitor Flag] &amp;lt;&amp;gt; 'N',[Monthly Competitor Sales])) as CMC_R12_P,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(IF(R3YOY = 'C',[Monthly Sales])) as YOY_R3_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R3YOY = 'P',[Monthly Sales])) as YOY_R3_P,&lt;/P&gt;&lt;P&gt;Sum(IF(R6YOY = 'C',[Monthly Sales])) as YOY_R6_C,&lt;/P&gt;&lt;P&gt;Sum(IF(R6YOY = 'P',[Monthly Sales])) as YOY_R6_P,&lt;/P&gt;&lt;P&gt;Sum(IF(YTDYOY = 'C',[Monthly Sales])) as YOY_R12_C,&lt;/P&gt;&lt;P&gt;Sum(IF(YTDYOY = 'P',[Monthly Sales])) as YOY_R12_P&lt;/P&gt;&lt;P&gt;resident &lt;/P&gt;&lt;P&gt;Fact_Table&lt;/P&gt;&lt;P&gt;where [Sold To Opt Out Flag] = 'N'&amp;nbsp; &lt;/P&gt;&lt;P&gt;GROUP BY &lt;/P&gt;&lt;P&gt;&amp;nbsp; [Brand Code],_CURR_TERR_DIM_ID,[Competitor Flag]&lt;/P&gt;&lt;P&gt;&amp;nbsp; //,[Organization Name]&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE Fact_Table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Left Join Fact Table with Territory Dimension Table with key as _CURR_TERR_DIM_ID to get [Region Number], [Division Number],[Territory Number].&lt;/P&gt;&lt;P&gt;left join(sum)&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;Distinct&lt;/P&gt;&lt;P&gt;_CURR_TERR_DIM_ID,&lt;/P&gt;&lt;P&gt;[Region Number],&lt;/P&gt;&lt;P&gt;[Division Number],&lt;/P&gt;&lt;P&gt;[Territory Number],&lt;/P&gt;&lt;P&gt;[Field Force Code],&lt;/P&gt;&lt;P&gt;[Territory Name]&lt;/P&gt;&lt;P&gt;Resident&lt;/P&gt;&lt;P&gt;Territory;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Get Distinct Brand Code, Brand Code_Region Number, Brand Code_Division Number and Brand Code_Territory Number from Fact Table to build the CSV File.&lt;/P&gt;&lt;P&gt;CSV_Table:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;Distinct&lt;/P&gt;&lt;P&gt;[Brand Code],&lt;/P&gt;&lt;P&gt;//[Brand Code] &amp;amp;'_' &amp;amp; [Organization Name] as BC_O,&lt;/P&gt;&lt;P&gt;[Brand Code] &amp;amp;'_' &amp;amp; [Region Number] as BC_R,&lt;/P&gt;&lt;P&gt;[Brand Code] &amp;amp;'_' &amp;amp; [Division Number] as BC_D,&lt;/P&gt;&lt;P&gt;[Brand Code] &amp;amp;'_' &amp;amp; [Territory Number] as BC_T,&lt;/P&gt;&lt;P&gt;[Brand Code] &amp;amp;'_' &amp;amp; [Field Force Code] as BC_FFC&lt;/P&gt;&lt;P&gt;Resident&lt;/P&gt;&lt;P&gt;sum;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join(CSV_Table)&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;[Brand Code],&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R3_P))&amp;nbsp;&amp;nbsp; OR Sum(RG_R3_P) = 0&amp;nbsp;&amp;nbsp; ,Null(),Round(((Sum(RG_R3_C)-Sum(RG_R3_P))/Sum(RG_R3_P) * 100),0.1))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS RG_R3_FRAN,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R6_P))&amp;nbsp;&amp;nbsp; OR Sum(RG_R6_P) = 0&amp;nbsp;&amp;nbsp; ,Null(),Round(((Sum(RG_R6_C)-Sum(RG_R6_P))/Sum(RG_R6_P) * 100),0.1))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS RG_R6_FRAN,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R12_P))&amp;nbsp; OR Sum(RG_R12_P) = 0&amp;nbsp; ,Null(),Round(((Sum(RG_R12_C)-Sum(RG_R12_P))/Sum(RG_R12_P) * 100),0.1))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS RG_R12_FRAN,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R3_P))&amp;nbsp; OR Sum(YOY_R3_P) = 0&amp;nbsp; ,Null(),Round(((Sum(YOY_R3_C)-Sum(YOY_R3_P))/Sum(YOY_R3_P) * 100),0.1))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS YOY_R3_FRAN,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R6_P))&amp;nbsp; OR Sum(YOY_R6_P) = 0&amp;nbsp; ,Null(),Round(((Sum(YOY_R6_C)-Sum(YOY_R6_P))/Sum(YOY_R6_P) * 100),0.1))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS YOY_R6_FRAN,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R12_P)) OR Sum(YOY_R12_P) = 0 ,Null(),Round(((Sum(YOY_R12_C)-Sum(YOY_R12_P))/Sum(YOY_R12_P) * 100),0.1))&amp;nbsp; AS YOY_R12_FRAN,&lt;/P&gt;&lt;P&gt;sum(RV_R3_C) as RVO_R3_C_FRAN,&lt;/P&gt;&lt;P&gt;sum(RV_R6_C) as RVO_R6_C_FRAN,&lt;/P&gt;&lt;P&gt;sum(RV_R12_C) as RVO_R12_C_FRAN,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF([Competitor Flag]='N',&lt;/P&gt;&lt;P&gt;IF(&lt;/P&gt;&lt;P&gt;&amp;nbsp; SUM(CM_R6_C)=0, 0, &lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(&lt;/P&gt;&lt;P&gt;&amp;nbsp; SUM(CM_R6_P)=0, 1, &lt;/P&gt;&lt;P&gt;&amp;nbsp; SUM(CM_R6_C)/SUM(CM_R6_P)&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;),&lt;/P&gt;&lt;P&gt;IF(&lt;/P&gt;&lt;P&gt;&amp;nbsp; SUM(CMC_R6_C)=0, 0, &lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(&lt;/P&gt;&lt;P&gt;&amp;nbsp; SUM(CMC_R6_P)=0, 1, &lt;/P&gt;&lt;P&gt;&amp;nbsp; SUM(CMC_R6_C)/SUM(CMC_R6_P)&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;AS COMP_FRAN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resident &lt;/P&gt;&lt;P&gt;sum&lt;/P&gt;&lt;P&gt;GROUP BY &lt;/P&gt;&lt;P&gt;[Brand Code],[Competitor Flag]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;[Brand Code],RC_R3_C as Total&lt;/P&gt;&lt;P&gt;Resident sum;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp1:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;[Brand Code],[Territory Name],sum(RC_R3_C) as TotalTerritory&lt;/P&gt;&lt;P&gt;Resident sum&lt;/P&gt;&lt;P&gt;Group by [Territory Name];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join(CSV_Table)&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;[Brand Code] &amp;amp;'_' &amp;amp; [Region Number] as BC_R,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R3_P))&amp;nbsp;&amp;nbsp; OR Sum(RG_R3_P) = 0&amp;nbsp;&amp;nbsp; ,Null(),Round(((Sum(RG_R3_C)-Sum(RG_R3_P))/Sum(RG_R3_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS RG_R3_REG,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R6_P))&amp;nbsp;&amp;nbsp; OR Sum(RG_R6_P) = 0&amp;nbsp;&amp;nbsp; ,Null(),Round(((Sum(RG_R6_C)-Sum(RG_R6_P))/Sum(RG_R6_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS RG_R6_REG,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R12_P))&amp;nbsp; OR Sum(RG_R12_P) = 0&amp;nbsp; ,Null(),Round(((Sum(RG_R12_C)-Sum(RG_R12_P))/Sum(RG_R12_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS RG_R12_REG,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R3_P))&amp;nbsp; OR Sum(YOY_R3_P) = 0&amp;nbsp; ,Null(),Round(((Sum(YOY_R3_C)-Sum(YOY_R3_P))/Sum(YOY_R3_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS YOY_R3_REG,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R6_P))&amp;nbsp; OR Sum(YOY_R6_P) = 0&amp;nbsp; ,Null(),Round(((Sum(YOY_R6_C)-Sum(YOY_R6_P))/Sum(YOY_R6_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS YOY_R6_REG,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R12_P)) OR Sum(YOY_R12_P) = 0 ,Null(),Round(((Sum(YOY_R12_C)-Sum(YOY_R12_P))/Sum(YOY_R12_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS YOY_R12_REG,&lt;/P&gt;&lt;P&gt;sum(RV_R3_C) as RVO_R3_C_REG,&lt;/P&gt;&lt;P&gt;sum(RV_R6_C) as RVO_R6_C_REG,&lt;/P&gt;&lt;P&gt;sum(RV_R12_C) as RVO_R12_C_REG&lt;/P&gt;&lt;P&gt;resident &lt;/P&gt;&lt;P&gt;sum&lt;/P&gt;&lt;P&gt;GROUP BY &lt;/P&gt;&lt;P&gt;&amp;nbsp; [Brand Code],[Region Number]&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;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join(CSV_Table)&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;[Brand Code] &amp;amp;'_' &amp;amp; [Division Number] as BC_D,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R3_P))&amp;nbsp;&amp;nbsp; OR Sum(RG_R3_P) = 0&amp;nbsp;&amp;nbsp; ,Null(),Round(((Sum(RG_R3_C)-Sum(RG_R3_P))/Sum(RG_R3_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS RG_R3_DIV,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R6_P))&amp;nbsp;&amp;nbsp; OR Sum(RG_R6_P) = 0&amp;nbsp;&amp;nbsp; ,Null(),Round(((Sum(RG_R6_C)-Sum(RG_R6_P))/Sum(RG_R6_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS RG_R6_DIV,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R12_P))&amp;nbsp; OR Sum(RG_R12_P) = 0&amp;nbsp; ,Null(),Round(((Sum(RG_R12_C)-Sum(RG_R12_P))/Sum(RG_R12_P) * 100),0.1))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS RG_R12_DIV,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R3_P))&amp;nbsp; OR Sum(YOY_R3_P) = 0&amp;nbsp; ,Null(),Round(((Sum(YOY_R3_C)-Sum(YOY_R3_P))/Sum(YOY_R3_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS YOY_R3_DIV,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R6_P))&amp;nbsp; OR Sum(YOY_R6_P) = 0&amp;nbsp; ,Null(),Round(((Sum(YOY_R6_C)-Sum(YOY_R6_P))/Sum(YOY_R6_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS YOY_R6_DIV,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R12_P)) OR Sum(YOY_R12_P) = 0 ,Null(),Round(((Sum(YOY_R12_C)-Sum(YOY_R12_P))/Sum(YOY_R12_P) * 100),0.1))&amp;nbsp; AS YOY_R12_DIV,&lt;/P&gt;&lt;P&gt;sum(RV_R3_C) as RVO_R3_C_DIV,&lt;/P&gt;&lt;P&gt;sum(RV_R6_C) as RVO_R6_C_DIV,&lt;/P&gt;&lt;P&gt;sum(RV_R12_C) as RVO_R12_C_DIV&lt;/P&gt;&lt;P&gt;resident &lt;/P&gt;&lt;P&gt;sum&lt;/P&gt;&lt;P&gt;GROUP BY &lt;/P&gt;&lt;P&gt;&amp;nbsp; [Brand Code],[Division Number];&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;/P&gt;&lt;P&gt;left join(CSV_Table)&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;[Brand Code] &amp;amp;'_'&amp;amp; [Territory Number] as BC_T,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R3_P))&amp;nbsp;&amp;nbsp; OR Sum(RG_R3_P) = 0&amp;nbsp;&amp;nbsp; ,Null(),Round(((Sum(RG_R3_C)-Sum(RG_R3_P))/Sum(RG_R3_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS RG_R3_TERR,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R6_P))&amp;nbsp;&amp;nbsp; OR Sum(RG_R6_P) = 0&amp;nbsp;&amp;nbsp; ,Null(),Round(((Sum(RG_R6_C)-Sum(RG_R6_P))/Sum(RG_R6_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS RG_R6_TERR,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(RG_R12_P))&amp;nbsp; OR Sum(RG_R12_P) = 0&amp;nbsp; ,Null(),Round(((Sum(RG_R12_C)-Sum(RG_R12_P))/Sum(RG_R12_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS RG_R12_TERR,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R3_P))&amp;nbsp; OR Sum(YOY_R3_P) = 0&amp;nbsp; ,Null(),Round(((Sum(YOY_R3_C)-Sum(YOY_R3_P))/Sum(YOY_R3_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS YOY_R3_TERR,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R6_P))&amp;nbsp; OR Sum(YOY_R6_P) = 0&amp;nbsp; ,Null(),Round(((Sum(YOY_R6_C)-Sum(YOY_R6_P))/Sum(YOY_R6_P) * 100),0.1))&amp;nbsp;&amp;nbsp; AS YOY_R6_TERR,&lt;/P&gt;&lt;P&gt;IF(IsNull(Sum(YOY_R12_P)) OR Sum(YOY_R12_P) = 0 ,Null(),Round(((Sum(YOY_R12_C)-Sum(YOY_R12_P))/Sum(YOY_R12_P) * 100),0.1))&amp;nbsp; AS YOY_R12_TERR,&lt;/P&gt;&lt;P&gt;sum(RV_R3_C) as RVO_R3_C_TERR,&lt;/P&gt;&lt;P&gt;sum(RV_R6_C) as RVO_R6_C_TERR,&lt;/P&gt;&lt;P&gt;sum(RV_R12_C) as RVO_R12_C_TERR&lt;/P&gt;&lt;P&gt;resident &lt;/P&gt;&lt;P&gt;sum&lt;/P&gt;&lt;P&gt;GROUP BY &lt;/P&gt;&lt;P&gt;&amp;nbsp; [Brand Code],[Territory Number]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Drop Unwanted fields and Rename the fields as required in the export csv layout.&lt;/P&gt;&lt;P&gt;CSV_File:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt;[Brand Code] as Brand,&lt;/P&gt;&lt;P&gt;subfield(BC_T,'_',2) as Territory,&lt;/P&gt;&lt;P&gt;subfield(BC_D,'_',2) as Division,&lt;/P&gt;&lt;P&gt;subfield(BC_R,'_',2) as Region&lt;/P&gt;&lt;P&gt;//subfield(BC_O,'_',2) as Organisation&lt;/P&gt;&lt;P&gt;resident CSV_Table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Fields BC_D,BC_R,BC_T,BC_FFC;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Tables sum,CSV_Table;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RENAME Table CSV_File to Fact_Agg;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;CSV_File_Temp:&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;Resident&lt;/P&gt;&lt;P&gt;Fact_Agg&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join(CSV_File_Temp)&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;[Brand Code],&lt;/P&gt;&lt;P&gt;[Brand Name] as Brand_Name&lt;/P&gt;&lt;P&gt;Resident&lt;/P&gt;&lt;P&gt;[Brand]&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;/P&gt;&lt;P&gt;new_csv:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;Distinct&lt;/P&gt;&lt;P&gt;Territory as TERR_NBR,&lt;/P&gt;&lt;P&gt;Brand_Name as BRAND,&lt;/P&gt;&lt;P&gt;//Organisation as ACCOUNT,&lt;/P&gt;&lt;P&gt;//Brand as BRAND,&lt;/P&gt;&lt;P&gt;RG_R3_FRAN,&lt;/P&gt;&lt;P&gt;RG_R6_FRAN,&lt;/P&gt;&lt;P&gt;RG_R12_FRAN,&lt;/P&gt;&lt;P&gt;RG_R3_REG,&lt;/P&gt;&lt;P&gt;RG_R6_REG,&lt;/P&gt;&lt;P&gt;RG_R12_REG,&lt;/P&gt;&lt;P&gt;RG_R3_DIV,&lt;/P&gt;&lt;P&gt;RG_R6_DIV,&lt;/P&gt;&lt;P&gt;RG_R12_DIV,&lt;/P&gt;&lt;P&gt;RG_R3_TERR,&lt;/P&gt;&lt;P&gt;RG_R6_TERR,&lt;/P&gt;&lt;P&gt;RG_R12_TERR,&lt;/P&gt;&lt;P&gt;RVO_R3_C_FRAN,&lt;/P&gt;&lt;P&gt;RVO_R6_C_FRAN,&lt;/P&gt;&lt;P&gt;RVO_R12_C_FRAN,&lt;/P&gt;&lt;P&gt;RVO_R3_C_REG,&lt;/P&gt;&lt;P&gt;RVO_R6_C_REG,&lt;/P&gt;&lt;P&gt;RVO_R12_C_REG,&lt;/P&gt;&lt;P&gt;RVO_R3_C_DIV,&lt;/P&gt;&lt;P&gt;RVO_R6_C_DIV,&lt;/P&gt;&lt;P&gt;RVO_R12_C_DIV,&lt;/P&gt;&lt;P&gt;RVO_R3_C_TERR,&lt;/P&gt;&lt;P&gt;RVO_R6_C_TERR,&lt;/P&gt;&lt;P&gt;RVO_R12_C_TERR,&lt;/P&gt;&lt;P&gt;YOY_R3_FRAN,&lt;/P&gt;&lt;P&gt;YOY_R6_FRAN,&lt;/P&gt;&lt;P&gt;YOY_R12_FRAN,&lt;/P&gt;&lt;P&gt;YOY_R3_REG,&lt;/P&gt;&lt;P&gt;YOY_R6_REG,&lt;/P&gt;&lt;P&gt;YOY_R12_REG,&lt;/P&gt;&lt;P&gt;YOY_R3_DIV,&lt;/P&gt;&lt;P&gt;YOY_R6_DIV,&lt;/P&gt;&lt;P&gt;YOY_R12_DIV,&lt;/P&gt;&lt;P&gt;YOY_R3_TERR,&lt;/P&gt;&lt;P&gt;YOY_R6_TERR,&lt;/P&gt;&lt;P&gt;YOY_R12_TERR,&lt;/P&gt;&lt;P&gt;COMP_FRAN,&lt;/P&gt;&lt;P&gt;CONT1&lt;/P&gt;&lt;P&gt;resident CSV_File_Temp&lt;/P&gt;&lt;P&gt;order by Brand_Name,Territory&lt;/P&gt;&lt;P&gt;//order by Brand,Territory&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Table CSV_File_Temp;&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;/P&gt;&lt;P&gt;store new_csv into \\Qliksb01\qlikview\Document\SourceDocuments\QVD Generators\FOIM\new.csv (txt);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE new_csv;&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;/P&gt;&lt;P&gt;exit script;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 09:21:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783423#M664779</guid>
      <dc:creator />
      <dc:date>2015-02-11T09:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783424#M664780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On which line are you getting error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You missed &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;[Brand Code] in your group by in this table.&lt;/SPAN&gt;&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;Temp1:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Brand Code],[Territory Name],sum(RC_R3_C) as TotalTerritory&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Resident sum&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Group by [Territory Name];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 09:28:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783424#M664780</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2015-02-11T09:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783425#M664781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;s its working fine now thanks anbu if you don't mind &lt;/P&gt;&lt;P&gt; can we see rank exp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=AGGR(NUM(RANK(SUM({&amp;lt;R6={'C'},[Organization Name]=,[Organization ID]=,[Organization Name|ID]=,[Sold To Opt Out Flag]={'N'}&amp;gt;}[Monthly Sales]), 4, 1)),[Organization Name|ID])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;same i have to write in a script editor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 09:50:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783425#M664781</guid>
      <dc:creator />
      <dc:date>2015-02-11T09:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to write this expression in script</title>
      <link>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783426#M664782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Temp:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;[Organization Name|ID]&lt;/SPAN&gt;,SUM([Monthly Sales]) MonthlySales&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Resident Table&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Where R6='C'&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Group by &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;[Organization Name|ID]&lt;/SPAN&gt;&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;Rank:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Load *,RowNo() As Rank Resident Temp Order by &lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;MonthlySales desc&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 09:54:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/how-to-write-this-expression-in-script/m-p/783426#M664782</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2015-02-11T09:54:55Z</dc:date>
    </item>
  </channel>
</rss>

