<?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 Rolling +- 6 months in line chart in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Rolling-6-months-in-line-chart/m-p/1901537#M74376</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want to show last 6 months and next 6 months data on selection in line chart&amp;nbsp; based on below scenarios:&lt;/P&gt;
&lt;P&gt;1)If no month is selected it should data based on max date in the data.&lt;/P&gt;
&lt;P&gt;2)if any month is selected it is should not only show that month's data but also past and next 6 months data.&lt;/P&gt;
&lt;P&gt;I used below expression but on selecting a month ,that month's data is correctly shown rest all months are coming as 100&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sum({&amp;lt;Month=,Year=,Date={"&amp;gt;=$(=addmonths(max(Date),-6))&amp;lt;=$(=addmonths(Max(Date),6))"}&amp;gt;}sales)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Iwin_0-1646506118621.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/73733iF5A11E00B7DC5534/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Iwin_0-1646506118621.png" alt="Iwin_0-1646506118621.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;What could be the issue here?&lt;/P&gt;</description>
    <pubDate>Sat, 05 Mar 2022 18:49:03 GMT</pubDate>
    <dc:creator>Iwin</dc:creator>
    <dc:date>2022-03-05T18:49:03Z</dc:date>
    <item>
      <title>Rolling +- 6 months in line chart</title>
      <link>https://community.qlik.com/t5/App-Development/Rolling-6-months-in-line-chart/m-p/1901537#M74376</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I want to show last 6 months and next 6 months data on selection in line chart&amp;nbsp; based on below scenarios:&lt;/P&gt;
&lt;P&gt;1)If no month is selected it should data based on max date in the data.&lt;/P&gt;
&lt;P&gt;2)if any month is selected it is should not only show that month's data but also past and next 6 months data.&lt;/P&gt;
&lt;P&gt;I used below expression but on selecting a month ,that month's data is correctly shown rest all months are coming as 100&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sum({&amp;lt;Month=,Year=,Date={"&amp;gt;=$(=addmonths(max(Date),-6))&amp;lt;=$(=addmonths(Max(Date),6))"}&amp;gt;}sales)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Iwin_0-1646506118621.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/73733iF5A11E00B7DC5534/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Iwin_0-1646506118621.png" alt="Iwin_0-1646506118621.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;What could be the issue here?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2022 18:49:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Rolling-6-months-in-line-chart/m-p/1901537#M74376</guid>
      <dc:creator>Iwin</dc:creator>
      <dc:date>2022-03-05T18:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling +- 6 months in line chart</title>
      <link>https://community.qlik.com/t5/App-Development/Rolling-6-months-in-line-chart/m-p/1901714#M74389</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Your approach seems to be correct and I have followed a similar approach as well, for my example. Maybe the following steps can help you with your use case scenario:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;1. I have the following dataset:&lt;/P&gt; 
&lt;P&gt;&lt;IMG alt="IMAGE" src="https://lithium-response-prod.s3.us-west-2.amazonaws.com/qlik.response.lithium.com/RESPONSEIMAGE/b7ac89a0-7486-41aa-93bd-b317a3dc4134.default.PNG" /&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;2. I have then created an &lt;SPAN style="color:#8e44ad"&gt;&lt;STRONG&gt;Date picker&lt;/STRONG&gt;&lt;/SPAN&gt; object with &lt;SPAN style="color:#27ae60"&gt;&lt;STRONG&gt;"Single date / interval"&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;STRONG&gt;checked&lt;/STRONG&gt;. This will allow only one value to be selected from the dataset.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;3. Then I have created a&lt;SPAN style="color:#8e44ad"&gt;&lt;STRONG&gt; Line chart&lt;/STRONG&gt;&lt;/SPAN&gt; with dimension set to&lt;SPAN style="color:#f39c12"&gt;&lt;STRONG&gt; "Date"&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;4. The measure set to:&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color:#2980b9"&gt;If&lt;/SPAN&gt;(&lt;BR /&gt; &amp;nbsp; &lt;SPAN style="color:#2980b9"&gt;GetFieldSelections&lt;/SPAN&gt;(&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;),&amp;nbsp;&lt;BR /&gt; &amp;nbsp; &lt;SPAN style="color:#2980b9"&gt;Sum&lt;/SPAN&gt;( {&amp;lt;&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;={&lt;SPAN style="color:#27ae60"&gt;"&amp;gt;=$(=AddMonths(GetFieldSelections(Date), -6))&amp;lt;=$(=AddMonths(GetFieldSelections(Date), 6))"&lt;/SPAN&gt;}&amp;gt;} &lt;SPAN style="color:#f39c12"&gt;Value&lt;/SPAN&gt;),&amp;nbsp;&lt;BR /&gt; &amp;nbsp; &lt;SPAN style="color:#2980b9"&gt;Sum&lt;/SPAN&gt;( {&amp;lt;&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;={&lt;SPAN style="color:#27ae60"&gt;"&amp;gt;=$(=AddMonths(Max(Date), -6))&amp;lt;=$(=AddMonths(Max(Date), 6))"&lt;/SPAN&gt;}&amp;gt;} &lt;SPAN style="color:#f39c12"&gt;Value&lt;/SPAN&gt;)&lt;BR /&gt; )&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;5. And as title I have set the expression:&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;=&lt;SPAN style="color:#3498db"&gt;If&lt;/SPAN&gt;(&lt;BR /&gt; &amp;nbsp; &lt;SPAN style="color:#2980b9"&gt;GetFieldSelections&lt;/SPAN&gt;(&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;),&amp;nbsp;&lt;BR /&gt; &amp;nbsp; &lt;SPAN style="color:#f39c12"&gt;'From: '&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color:#2980b9"&gt;AddMonths&lt;/SPAN&gt;(&lt;SPAN style="color:#2980b9"&gt;GetFieldSelections&lt;/SPAN&gt;(&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;), -6) &amp;amp; &lt;SPAN style="color:#27ae60"&gt;' to: '&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color:#2980b9"&gt;AddMonths&lt;/SPAN&gt;(&lt;SPAN style="color:#2980b9"&gt;GetFieldSelections&lt;/SPAN&gt;(&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;), 6) &amp;amp; &lt;SPAN style="color:#27ae60"&gt;' based on date: ' &lt;/SPAN&gt;&amp;amp; &lt;SPAN style="color:#2980b9"&gt;GetFieldSelections&lt;/SPAN&gt;(&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;),&lt;BR /&gt; &amp;nbsp; &lt;SPAN style="color:#27ae60"&gt;'From: '&lt;/SPAN&gt; &amp;amp; &lt;SPAN style="color:#2980b9"&gt;AddMonths&lt;/SPAN&gt;(&lt;SPAN style="color:#2980b9"&gt;Max&lt;/SPAN&gt;(&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;), -6) &amp;amp;&lt;SPAN style="color:#f39c12"&gt; &lt;/SPAN&gt;&lt;SPAN style="color:#27ae60"&gt;' to: ' &lt;/SPAN&gt;&amp;amp; &lt;SPAN style="color:#2980b9"&gt;AddMonths&lt;/SPAN&gt;(&lt;SPAN style="color:#2980b9"&gt;Max&lt;/SPAN&gt;(&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;), 6) &amp;amp;&lt;SPAN style="color:#27ae60"&gt; ' based on date: ' &lt;/SPAN&gt;&amp;amp; &lt;SPAN style="color:#2980b9"&gt;Max&lt;/SPAN&gt;(&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;)&lt;BR /&gt; )&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;This will allow us to check if the selected dates within the set analysis are the correct ones. Here are the outputs:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;6. When NO date is selected:&lt;/P&gt; 
&lt;P&gt;&lt;IMG alt="IMAGE" src="https://lithium-response-prod.s3.us-west-2.amazonaws.com/qlik.response.lithium.com/RESPONSEIMAGE/e0a30c34-f4d8-41d8-b8d3-009413479dec.default.PNG" /&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;As you can see, the &lt;STRONG&gt;&lt;SPAN style="color:#2980b9"&gt;Max&lt;/SPAN&gt;(&lt;SPAN style="color:#f39c12"&gt;Date&lt;/SPAN&gt;)&lt;/STRONG&gt; is &lt;SPAN style="color:#8e44ad"&gt;&lt;STRONG&gt;9/1/2021&lt;/STRONG&gt;&lt;/SPAN&gt; so the starting date is &lt;SPAN style="color:#8e44ad"&gt;&lt;STRONG&gt;3/1/2021&lt;/STRONG&gt;&lt;/SPAN&gt; and the end date is &lt;SPAN style="color:#8e44ad"&gt;&lt;STRONG&gt;3/1/2022&lt;/STRONG&gt;&lt;/SPAN&gt;. The values displayed on the graph are also correct, based on the loaded dataset.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;7. When a date is selected:&lt;/P&gt; 
&lt;P&gt;&lt;IMG alt="IMAGE" src="https://lithium-response-prod.s3.us-west-2.amazonaws.com/qlik.response.lithium.com/RESPONSEIMAGE/f415256e-2ec4-4e36-9faa-0a2b7c5c1cb4.default.PNG" /&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;As you can see, the selected date value&amp;nbsp;is&lt;SPAN style="color:#8e44ad"&gt;&lt;STRONG&gt; 5/1/2019&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;so the starting date is &lt;SPAN style="color:#8e44ad"&gt;&lt;STRONG&gt;11/1/2018&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;and the end date is &lt;SPAN style="color:#8e44ad"&gt;&lt;STRONG&gt;11/1/2018&lt;/STRONG&gt;&lt;/SPAN&gt;. The values displayed on the graph are also correct, based on the loaded dataset.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Maybe you can try this approach so you could also easily troubleshoot the values on your side.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN style="color:#7f8c8d"&gt;&lt;EM&gt;&lt;STRONG&gt;I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt; &amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 10:21:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Rolling-6-months-in-line-chart/m-p/1901714#M74389</guid>
      <dc:creator>Andrei_Cusnir</dc:creator>
      <dc:date>2022-03-07T10:21:32Z</dc:date>
    </item>
  </channel>
</rss>

