<?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: Set Analysis and Dollar Sign Expansion in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932750#M76838</link>
    <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;TranYr =&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{$(=PrevYr)}&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt;$(=FieldName)&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp; can only return a Single value; So if there are different values in Field it will return null&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Correct way to avoid this is to use an aggregation function&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;TranYr =&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{"$(=Max(PrevYr))"}&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try $(=PrevYr)&amp;nbsp; on below data&lt;/P&gt;
&lt;P&gt;raw:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;ID,TranYr,PrevYr&lt;BR /&gt;1,2021,2021&lt;BR /&gt;2,2022,2021&lt;BR /&gt;3,2021,2021&lt;BR /&gt;4,2022,2021&lt;BR /&gt;5,2021,2021&lt;BR /&gt;6,2000,1999&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2022 01:41:43 GMT</pubDate>
    <dc:creator>vinieme12</dc:creator>
    <dc:date>2022-05-19T01:41:43Z</dc:date>
    <item>
      <title>Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932072#M76805</link>
      <description>&lt;P&gt;Hi - I've searched the community on this question but am still a bit unclear. I know dollar sign expansion is used as a replacement value, especially when you have a measure or a function, but in the example below, I'm using all fields from the load script, no functions or variables. Can someone explain why the 2nd option below works? The only difference is, I'm using dollar sign expansion.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Doesn't work (no syntax errors, but result incorrect/too low):&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, TranYr =&lt;FONT color="#CC99FF"&gt;&lt;STRONG&gt; {PrevYr} &lt;/STRONG&gt;&lt;/FONT&gt;&amp;gt;} &lt;BR /&gt;if(placedt_all=aggr( nodistinct max({1} placedt_all),acctpol), Placed))&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Works (more reasonable end result):&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, TranYr =&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt; {$(=PrevYr)}&lt;/FONT&gt;&lt;/STRONG&gt; &amp;gt;} &lt;BR /&gt;if(placedt_all=aggr( nodistinct max({1} placedt_all),acctpol), Placed))&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 23:02:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932072#M76805</guid>
      <dc:creator>newuser</dc:creator>
      <dc:date>2022-05-17T23:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932163#M76812</link>
      <description>&lt;P&gt;Refer these blogs,&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3406" target="_blank"&gt;https://community.qlik.com/qlik-blogpost/3406&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-Little-Equals-Sign/ba-p/1475639" target="_blank" rel="noopener"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/The-Little-Equals-Sign/ba-p/1475639&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-Magic-of-Dollar-Expansions/ba-p/1471979" target="_blank" rel="noopener"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/The-Magic-of-Dollar-Expansions/ba-p/1471979&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 05:58:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932163#M76812</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-05-18T05:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932168#M76813</link>
      <description>&lt;P&gt;If your&amp;nbsp; variable is defined with and = sign or not also makes a difference&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also look at the expression editor to see how your variables are being evaluated&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="qlikCommunity1.PNG" style="width: 478px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/79685i981993766A32206D/image-size/large?v=v2&amp;amp;px=999" role="button" title="qlikCommunity1.PNG" alt="qlikCommunity1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 06:01:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932168#M76813</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-05-18T06:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932505#M76826</link>
      <description>&lt;P&gt;What I'm asking about is NOT variables but fields. Those blogs talk about variables. My question is, why does a dollar sign expansion&amp;nbsp; make a difference for FIELDS? THank you.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 13:43:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932505#M76826</guid>
      <dc:creator>newuser</dc:creator>
      <dc:date>2022-05-18T13:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932565#M76828</link>
      <description>&lt;P&gt;&lt;STRONG&gt;{PrevYr}&lt;/STRONG&gt;&amp;nbsp;isn't referencing to&amp;nbsp;a field else it's treated as a string like:&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{'PrevYr'}&lt;/STRONG&gt;&amp;nbsp;and&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt;{$(=PrevYr)}&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;evaluates the content of the $-sign expansion at first which means in this case: only(PrevYr) and used then this result.&lt;/P&gt;
&lt;P&gt;Beside this you couldn't compare a field against a field within a real set analysis because it worked like a selection on a column-level and not on a row-level. You may use something like: ... FieldX = {"=FieldA=FieldB"} ... but it's just an if-loop with another syntax.&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 15:21:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932565#M76828</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-05-18T15:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932566#M76829</link>
      <description>&lt;P&gt;So &lt;STRONG&gt;PrevYr&lt;/STRONG&gt; is a field??&lt;/P&gt;
&lt;P&gt;You absolutely don't need to $ expand a field, why are you even trying this?&lt;/P&gt;
&lt;P&gt;Again the same thing applies, you can see how your expression evaluates in the expression editor when you $wrap a field&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to do a row level comparison try as below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"}, TranYr = {"=&lt;STRONG&gt;TranYr=PrevYr&lt;/STRONG&gt;"} &amp;gt;}&lt;/P&gt;
&lt;P&gt;if(placedt_all=aggr( nodistinct max({1} placedt_all),acctpol), Placed))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sum({1 &amp;lt;Month_Placed ={"&amp;lt;=$(=CurrMonth)"} &amp;gt;}&lt;/P&gt;
&lt;P&gt;if(placedt_all=aggr( nodistinct max({1} placedt_all),acctpol)&amp;nbsp; And TranYr=PrevYr , Placed))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 15:23:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932566#M76829</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-05-18T15:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932643#M76834</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;, then I think you're saying my dollar sign expansion below is "ok" ? Or is the best practice to use the second method you mentioned, i.e.,&amp;nbsp;&lt;SPAN&gt;FieldX = {"=FieldA=FieldB"}? Either way, I seem to be getting the same result. Trying to think in what situations would the result be different.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;TranYr =&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{$(=PrevYr)}&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 17:36:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932643#M76834</guid>
      <dc:creator>newuser</dc:creator>
      <dc:date>2022-05-18T17:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932644#M76835</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/2751"&gt;@vinieme12&lt;/a&gt;&amp;nbsp;, I seem to be getting the same result whether I use the syntax below or the suggested one above, i.e.,&amp;nbsp;&lt;SPAN&gt;TranYr = {"=&lt;/SPAN&gt;&lt;STRONG&gt;TranYr=PrevYr&lt;/STRONG&gt;&lt;SPAN&gt;"}&amp;nbsp;.&amp;nbsp; Can you give me a hypothetical example or scenario where the syntax below would NOT work?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;TranYr =&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{$(=PrevYr)}&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 17:35:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932644#M76835</guid>
      <dc:creator>newuser</dc:creator>
      <dc:date>2022-05-18T17:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932750#M76838</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;TranYr =&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{$(=PrevYr)}&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt;$(=FieldName)&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp; can only return a Single value; So if there are different values in Field it will return null&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Correct way to avoid this is to use an aggregation function&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;TranYr =&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#CC99FF"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{"$(=Max(PrevYr))"}&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try $(=PrevYr)&amp;nbsp; on below data&lt;/P&gt;
&lt;P&gt;raw:&lt;BR /&gt;Load * Inline [&lt;BR /&gt;ID,TranYr,PrevYr&lt;BR /&gt;1,2021,2021&lt;BR /&gt;2,2022,2021&lt;BR /&gt;3,2021,2021&lt;BR /&gt;4,2022,2021&lt;BR /&gt;5,2021,2021&lt;BR /&gt;6,2000,1999&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 01:41:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932750#M76838</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-05-19T01:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis and Dollar Sign Expansion</title>
      <link>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932802#M76843</link>
      <description>&lt;P&gt;It depends on data, data-model and UI requirements if applying if-loops or statements like&amp;nbsp;&lt;SPAN&gt;{"=FieldA=FieldB"}&lt;/SPAN&gt;&amp;nbsp;are suitable or not. In general there are better approaches possible, for example making such checks already within the script in a flag-field and then querying this flag in the UI or creating a data-model which has only a single year-field.&lt;/P&gt;
&lt;P&gt;Not each part of the requirements might be solvable in an optimized way - at least not all together ... Sometimes the second/third best approach is practically enough. It depends ...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 06:03:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-Analysis-and-Dollar-Sign-Expansion/m-p/1932802#M76843</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-05-19T06:03:30Z</dc:date>
    </item>
  </channel>
</rss>

