<?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: A formula for cleaning data in a script in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/A-formula-for-cleaning-data-in-a-script/m-p/1921779#M10610</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Thank you for your help. I succeeded.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Where&amp;nbsp;&amp;nbsp;Month1 - Month2 = 1&lt;BR /&gt;or Month2=202203 and Month1&amp;gt;202203 &lt;BR /&gt;or Month1=202201 and Month2=202112;&lt;BR /&gt;&lt;BR /&gt;My results didn't change.Do you have a better expression?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 24 Apr 2022 07:51:37 GMT</pubDate>
    <dc:creator>Midchen</dc:creator>
    <dc:date>2022-04-24T07:51:37Z</dc:date>
    <item>
      <title>A formula for cleaning data in a script</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/A-formula-for-cleaning-data-in-a-script/m-p/1921262#M10604</link>
      <description>&lt;P class="tgt" data-section="0"&gt;&lt;SPAN class="tgt" data-section="0" data-sentence="0" data-group="0-0"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm a beginner, and I don't know how to filter fields in scripts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;The script I loaded was as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="tgt" data-section="1"&gt;&lt;SPAN class="tgt" data-section="1" data-sentence="0" data-group="1-0"&gt;Load&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="tgt" data-section="2"&gt;&lt;SPAN class="tgt" data-section="2" data-sentence="0" data-group="2-0"&gt;Month1,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="tgt" data-section="3"&gt;&lt;SPAN class="tgt" data-section="3" data-sentence="0" data-group="3-0"&gt;Month2,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="tgt" data-section="4"&gt;&lt;SPAN class="tgt" data-section="4" data-sentence="0" data-group="4-0"&gt;Value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="tgt" data-section="5"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="tgt" data-section="6"&gt;&lt;SPAN class="tgt" data-section="6" data-sentence="0" data-group="6-0"&gt;These are the three fields in my script.&lt;/SPAN&gt;&lt;SPAN class="tgt" data-section="6" data-sentence="1" data-group="6-1"&gt;But actually Value is not the metric I need, and the metric I need needs to be filtered&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="tgt" data-section="7"&gt;=Sum({&amp;lt;Month1={"&amp;gt;=202203"},[Month2]={"202202"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202202"},[Month2]={"202201"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202201"},[Month2]={"202112"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202112"},[Month2]={"202111"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202111"},[Month2]={"202110"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202110"},[Month2]={"202109"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202109"},[Month2]={"202108"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202108"},[Month2]={"202107"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202107"},[Month2]={"202106"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202106"},[Month2]={"202105"}&amp;gt;&lt;BR /&gt;+&amp;lt;Month1={"202105"},[Month2]={"202104"}&amp;gt;}Value)&lt;/P&gt;
&lt;P class="tgt" data-section="18"&gt;&lt;SPAN class="tgt" data-section="18" data-sentence="0" data-group="18-0"&gt;But I don't think it's necessary to write this function in every diagram. I tried to filter the Value directly in the script, but it was wrong no matter how I wrote it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="tgt" data-section="19"&gt;&lt;SPAN class="tgt" data-section="19" data-sentence="0" data-group="19-0"&gt;How to filter the Value field in the script?&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 07:54:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/A-formula-for-cleaning-data-in-a-script/m-p/1921262#M10604</guid>
      <dc:creator>Midchen</dc:creator>
      <dc:date>2022-04-22T07:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: A formula for cleaning data in a script</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/A-formula-for-cleaning-data-in-a-script/m-p/1921401#M10607</link>
      <description>&lt;P&gt;Personally I would tend to a logic like the following by adding a more suitable period-field which isn't:&lt;/P&gt;
&lt;P&gt;year(date) * 100 + month(date)&lt;/P&gt;
&lt;P&gt;else&lt;/P&gt;
&lt;P&gt;year(date) * 12 + month(date)&lt;/P&gt;
&lt;P&gt;because with it you could always calculate the offset between two periods directly even by the turn of a year.&lt;/P&gt;
&lt;P&gt;Afterwards you could apply something like this:&lt;/P&gt;
&lt;P&gt;... where Month1 &amp;gt; X and Month2 &amp;lt; Y and Month1 - Month2 = 1;&lt;/P&gt;
&lt;P&gt;whereby I think I wouldn't apply a hard filter else using the offset-calculation as flag-field - later used within the set analysis and/or as selection within a list-box.&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 11:57:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/A-formula-for-cleaning-data-in-a-script/m-p/1921401#M10607</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-04-22T11:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: A formula for cleaning data in a script</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/A-formula-for-cleaning-data-in-a-script/m-p/1921779#M10610</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you for your help. I succeeded.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Where&amp;nbsp;&amp;nbsp;Month1 - Month2 = 1&lt;BR /&gt;or Month2=202203 and Month1&amp;gt;202203 &lt;BR /&gt;or Month1=202201 and Month2=202112;&lt;BR /&gt;&lt;BR /&gt;My results didn't change.Do you have a better expression?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Apr 2022 07:51:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/A-formula-for-cleaning-data-in-a-script/m-p/1921779#M10610</guid>
      <dc:creator>Midchen</dc:creator>
      <dc:date>2022-04-24T07:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: A formula for cleaning data in a script</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/A-formula-for-cleaning-data-in-a-script/m-p/1921913#M10619</link>
      <description>&lt;P&gt;I think the operators and the order between the conditions aren't correct and might look more like:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Where&amp;nbsp;&amp;nbsp;Month1 - Month2 = 1 &lt;STRONG&gt;and&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;STRONG&gt;((&lt;/STRONG&gt;Month2=202203 and Month1&amp;gt;202203&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;STRONG&gt;or (&lt;/STRONG&gt;Month1=202201 and Month2=202112&lt;STRONG&gt;))&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Within the UI you may reach just with the mentioned offset-flag, like:&lt;/P&gt;
&lt;P&gt;sum({&amp;lt; Flag = {1}&amp;gt;} Value)&lt;/P&gt;
&lt;P&gt;and selecting the wanted periods either from Month1 or Month2 because both information will interact with each other. Depending on your final requirements you may need some extra logic like querying for the current period and/or for cases where the flag becomes negative or ...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally you may also considering to extend the data-model with &lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table/ba-p/1466130" target="_blank"&gt;The As-Of Table - Qlik Community - 1466130&lt;/A&gt;&amp;nbsp;to simplify the access on the wanted periods.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 06:35:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/A-formula-for-cleaning-data-in-a-script/m-p/1921913#M10619</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-04-25T06:35:35Z</dc:date>
    </item>
  </channel>
</rss>

