<?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: Cumulative AS AT Position in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2117468#M91175</link>
    <description>&lt;P&gt;Pl share sample data and expected output, that will help to build script faster. Not able to clearly visualize what is expected when we make selections in the date picker, lets say 09/10/2023&lt;/P&gt;</description>
    <pubDate>Fri, 15 Sep 2023 14:52:16 GMT</pubDate>
    <dc:creator>Digvijay_Singh</dc:creator>
    <dc:date>2023-09-15T14:52:16Z</dc:date>
    <item>
      <title>Cumulative AS AT Position</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2117465#M91174</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The Data warehouse that we are building the Qliksense dashboard app off is a contra-correction Database.&amp;nbsp; &amp;nbsp;I want to use a date picker to get an AS AT position in history.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Facts use contra correction logic to give movements if there is a change, eg If a Fact changes from 10,000 to 11,000 on day 2, and again to 12,000 on Day 5&lt;/P&gt;
&lt;P&gt;Day 1 : Fact Value = 10,000&lt;/P&gt;
&lt;P&gt;Day 2 : Fact Value = -10,000&lt;/P&gt;
&lt;P&gt;Day 2 : Fact Value = 11,000&lt;/P&gt;
&lt;P&gt;Day 5 : Fact Value = -11,000&lt;/P&gt;
&lt;P&gt;Day 5 : Fact Value = 12,000&lt;/P&gt;
&lt;P&gt;Thus we know that on Day 1 the Value was 10,000, an that the movement on day 2 was 1,000, but the AS AT for Days 2,3 and 4 is 11,000, and by Day 5 its 12,000.&amp;nbsp; The Time slice on the Warehouse uses ReportedDate.&lt;/P&gt;
&lt;P&gt;When I introduce a Datepicker using the ReportedDate i just get the movements on that day, when I want to SUM(Fact Value) WHERE ReportedDate &amp;lt;= Datepicker value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any Ideas how to accomplish this?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 14:44:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2117465#M91174</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2023-09-15T14:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative AS AT Position</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2117468#M91175</link>
      <description>&lt;P&gt;Pl share sample data and expected output, that will help to build script faster. Not able to clearly visualize what is expected when we make selections in the date picker, lets say 09/10/2023&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 14:52:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2117468#M91175</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2023-09-15T14:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative AS AT Position</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2117479#M91176</link>
      <description>&lt;P&gt;Sorry, I have attached a simple CSV with the Data&lt;/P&gt;
&lt;P&gt;The core of it is that on a Table I want to see One row with the AS AT value&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="288"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;Date&lt;/TD&gt;
&lt;TD width="96"&gt;Movement&lt;/TD&gt;
&lt;TD width="97"&gt;AS AT Value&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;10-Sep-23&lt;/TD&gt;
&lt;TD&gt;10000&lt;/TD&gt;
&lt;TD&gt;10000&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;11-Sep-23&lt;/TD&gt;
&lt;TD&gt;1000&lt;/TD&gt;
&lt;TD&gt;11000&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12-Sep-23&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;11000&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;13-Sep-24&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;11000&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;14-Sep-23&lt;/TD&gt;
&lt;TD&gt;1000&lt;/TD&gt;
&lt;TD&gt;12000&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have a Date picker and select 12-Sep-2023, I should See 11,000, but if I select 14-Sept I should see 12,000.&lt;/P&gt;
&lt;P&gt;Obviously there are more attributes but they have no bearing on the Output.&lt;/P&gt;
&lt;P&gt;Ih TSQL the Query would be&lt;/P&gt;
&lt;P&gt;SELECT SUM(Value) FROM TABLE WHERE ReportedDate&amp;lt;='12-Sep-2023' (or 14-Sept-2023).&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 15:06:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2117479#M91176</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2023-09-15T15:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative AS AT Position</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2117541#M91183</link>
      <description>&lt;DIV id="tinyMceEditor_21480eb8f26a2bDigvijay_Singh_4" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;I would prefer using As Of Date calendar in such situation but not sure if it fit to your other needs -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;fact:&lt;BR /&gt;Load Date#(ReportedDate,'DD-MMM-YY') as [_date_key],&lt;BR /&gt;Value&lt;BR /&gt;inline [&lt;BR /&gt;ReportedDate, Value &lt;BR /&gt;10-Sep-23, 10000&lt;BR /&gt;11-Sep-23, -10000&lt;BR /&gt;11-Sep-23, 11000&lt;BR /&gt;14-Sep-23, -11000&lt;BR /&gt;14-Sep-23, 12000&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;BR /&gt;master_calendar:&lt;BR /&gt;//=== Generate a temp table of dates === &lt;BR /&gt;LOAD &lt;BR /&gt;[Cal Date],&lt;BR /&gt;[Cal Date] as _date_key;&lt;BR /&gt;LOAD &lt;BR /&gt;date(mindate + IterNo(),'DD-MMM-YY') as [Cal Date]&lt;BR /&gt;WHILE mindate + IterNo() &amp;lt;= maxdate;&lt;/P&gt;
&lt;P&gt;//=== Get min/max dates from Field ===/&lt;BR /&gt;LOAD&lt;BR /&gt;min(FieldValue('_date_key', recno()))-1 as mindate,&lt;BR /&gt;max(FieldValue('_date_key', recno())) as maxdate&lt;BR /&gt;AUTOGENERATE FieldValueCount('_date_key');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// ======== Create a list of distinct Dates========&lt;BR /&gt;tmpAsOfCalendar:&lt;BR /&gt;Load distinct [Cal Date] &lt;BR /&gt;Resident [master_calendar] ;&lt;/P&gt;
&lt;P&gt;// ======== Cartesian product with itself ========&lt;BR /&gt;Join (tmpAsOfCalendar)&lt;BR /&gt;Load [Cal Date] as [As of Cal Date]&lt;BR /&gt;Resident tmpAsOfCalendar ;&lt;/P&gt;
&lt;P&gt;[As-Of-Date Calendar]:&lt;BR /&gt;Load [Cal Date],&lt;BR /&gt;[As of Cal Date],&lt;BR /&gt;Round([As of Cal Date]-[Cal Date]) as DateDiff&lt;BR /&gt;Resident tmpAsOfCalendar&lt;BR /&gt;Where [As of Cal Date] &amp;gt;= [Cal Date]&lt;BR /&gt;;&lt;BR /&gt;Drop table tmpAsOfCalendar;&lt;/P&gt;
&lt;DIV id="tinyMceEditor_21480eb8f26a2bDigvijay_Singh_1" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="tinyMceEditor_21480eb8f26a2bDigvijay_Singh_3" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 18:34:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2117541#M91183</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2023-09-15T18:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative AS AT Position</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2119927#M91227</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;I took a slightly different tack and used a Calendar Dimension that wasn't attached to the Data, this allowed me to do&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=SUM(IF(ReportedDate&amp;lt;=GetSelectedItem(CalendarDate),SUM(Measure)).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 10:07:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-AS-AT-Position/m-p/2119927#M91227</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2023-09-19T10:07:27Z</dc:date>
    </item>
  </channel>
</rss>

