<?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 If statement in line chart in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/If-statement-in-line-chart/m-p/1822728#M67471</link>
    <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;I'm developing a simple application and want to show revenue in a line chart (over month). I am showing two line, selected year in blue and previous year in purple.&lt;/P&gt;&lt;P&gt;If the user selects this year (2021), the chart is showing 2021 vs. 2020. Since this year is not over yet, I want to show YTD numbers for 2021 and 2020.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielLief_0-1626441531153.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/58742iA14650779B9187A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielLief_0-1626441531153.png" alt="DanielLief_0-1626441531153.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;vCY = 2021&lt;BR /&gt;vMaxMonthCY = 7&lt;/P&gt;&lt;P&gt;if(Year=$(=vCY),&lt;BR /&gt;count({$&amp;lt;Kreis={"1*"},[Year]={"$(=max(year(Datum)-1))"},Month={"&amp;lt;=$(vMaxMonthCY)"}&amp;gt;} distinct %veakopID),&lt;BR /&gt;count({$&amp;lt;Kreis={"1*"},[Year]={"$(=max(year(Datum)-1))"}&amp;gt;} distinct %veakopID))&lt;/P&gt;&lt;P&gt;Somehow the if statement is not working correctly. If I just write:&lt;/P&gt;&lt;P&gt;count({$&amp;lt;Kreis={"1*"},[Year]={"$(=max(year(Datum)-1))"},Month={"&amp;lt;=$(vMaxMonthCY)"}&amp;gt;} distinct %veakopID)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielLief_0-1626442370673.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/58745i5FC332D56D16014C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielLief_0-1626442370673.png" alt="DanielLief_0-1626442370673.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The chart is showing what I expect. Included in the if statement it always uses the else path.&lt;/P&gt;&lt;P&gt;if(Year=$(=vCY),&lt;BR /&gt;1,&lt;BR /&gt;0)&lt;/P&gt;&lt;P&gt;Using this as a test, it shows 1. So the if clause is working.&lt;/P&gt;&lt;P&gt;I have no idea what to change. Maybe one of you have an idea?&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jul 2021 13:33:10 GMT</pubDate>
    <dc:creator>DanielLief</dc:creator>
    <dc:date>2021-07-16T13:33:10Z</dc:date>
    <item>
      <title>If statement in line chart</title>
      <link>https://community.qlik.com/t5/App-Development/If-statement-in-line-chart/m-p/1822728#M67471</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;I'm developing a simple application and want to show revenue in a line chart (over month). I am showing two line, selected year in blue and previous year in purple.&lt;/P&gt;&lt;P&gt;If the user selects this year (2021), the chart is showing 2021 vs. 2020. Since this year is not over yet, I want to show YTD numbers for 2021 and 2020.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielLief_0-1626441531153.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/58742iA14650779B9187A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielLief_0-1626441531153.png" alt="DanielLief_0-1626441531153.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;vCY = 2021&lt;BR /&gt;vMaxMonthCY = 7&lt;/P&gt;&lt;P&gt;if(Year=$(=vCY),&lt;BR /&gt;count({$&amp;lt;Kreis={"1*"},[Year]={"$(=max(year(Datum)-1))"},Month={"&amp;lt;=$(vMaxMonthCY)"}&amp;gt;} distinct %veakopID),&lt;BR /&gt;count({$&amp;lt;Kreis={"1*"},[Year]={"$(=max(year(Datum)-1))"}&amp;gt;} distinct %veakopID))&lt;/P&gt;&lt;P&gt;Somehow the if statement is not working correctly. If I just write:&lt;/P&gt;&lt;P&gt;count({$&amp;lt;Kreis={"1*"},[Year]={"$(=max(year(Datum)-1))"},Month={"&amp;lt;=$(vMaxMonthCY)"}&amp;gt;} distinct %veakopID)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielLief_0-1626442370673.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/58745i5FC332D56D16014C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielLief_0-1626442370673.png" alt="DanielLief_0-1626442370673.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The chart is showing what I expect. Included in the if statement it always uses the else path.&lt;/P&gt;&lt;P&gt;if(Year=$(=vCY),&lt;BR /&gt;1,&lt;BR /&gt;0)&lt;/P&gt;&lt;P&gt;Using this as a test, it shows 1. So the if clause is working.&lt;/P&gt;&lt;P&gt;I have no idea what to change. Maybe one of you have an idea?&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 13:33:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-statement-in-line-chart/m-p/1822728#M67471</guid>
      <dc:creator>DanielLief</dc:creator>
      <dc:date>2021-07-16T13:33:10Z</dc:date>
    </item>
  </channel>
</rss>

