<?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 expand a variable in an alternate state in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/expand-a-variable-in-an-alternate-state/m-p/2520735#M1226571</link>
    <description>&lt;P&gt;Hi, everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In QV May 2024 alternate state description (&lt;A href="https://help.qlik.com/en-US/qlikview/May2024/Subsystems/Client/Content/QV_QlikView/Alternate%20States.htm" target="_blank" rel="noopener"&gt;https://help.qlik.com/en-US/qlikview/May2024/Subsystems/Client/Content/QV_QlikView/Alternate%20States.htm&lt;/A&gt;), at the end is stated:&lt;/P&gt;&lt;P&gt;If you have a state named&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;MyState&lt;/SPAN&gt;, and a variable named&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;vMyVar&lt;/SPAN&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class=""&gt;$(vMyVar)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expands the variable in the default state.&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;$({MyState} vMyVar)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expands the variable in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;MyState&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;state.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have a Calendar where each date (field Date) has its Year (column Year); I then have a variable vMaxDate = max(Date) and 2 selectors (List Boxes of the field Year) - one in default state and another in a state PY&lt;/P&gt;&lt;P&gt;when I write in a text box ='$(vMaxDate)' it returns 31.12.2025 ; if 2025 is selected from the first selector.&lt;/P&gt;&lt;P&gt;when I write&amp;nbsp;in a text box ='$({PY}vMaxDate)' and select 2024 from the second selector, nothing is displayed (blank), but if I write =max({PY}Date) in the text box, then 31.12.2024 is shown.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know why variable expansion in alternate state is not working as explained?&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jun 2025 11:59:21 GMT</pubDate>
    <dc:creator>iliyansomlev</dc:creator>
    <dc:date>2025-06-10T11:59:21Z</dc:date>
    <item>
      <title>expand a variable in an alternate state</title>
      <link>https://community.qlik.com/t5/QlikView/expand-a-variable-in-an-alternate-state/m-p/2520735#M1226571</link>
      <description>&lt;P&gt;Hi, everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In QV May 2024 alternate state description (&lt;A href="https://help.qlik.com/en-US/qlikview/May2024/Subsystems/Client/Content/QV_QlikView/Alternate%20States.htm" target="_blank" rel="noopener"&gt;https://help.qlik.com/en-US/qlikview/May2024/Subsystems/Client/Content/QV_QlikView/Alternate%20States.htm&lt;/A&gt;), at the end is stated:&lt;/P&gt;&lt;P&gt;If you have a state named&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;MyState&lt;/SPAN&gt;, and a variable named&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;vMyVar&lt;/SPAN&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN class=""&gt;$(vMyVar)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expands the variable in the default state.&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;$({MyState} vMyVar)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expands the variable in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;MyState&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;state.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have a Calendar where each date (field Date) has its Year (column Year); I then have a variable vMaxDate = max(Date) and 2 selectors (List Boxes of the field Year) - one in default state and another in a state PY&lt;/P&gt;&lt;P&gt;when I write in a text box ='$(vMaxDate)' it returns 31.12.2025 ; if 2025 is selected from the first selector.&lt;/P&gt;&lt;P&gt;when I write&amp;nbsp;in a text box ='$({PY}vMaxDate)' and select 2024 from the second selector, nothing is displayed (blank), but if I write =max({PY}Date) in the text box, then 31.12.2024 is shown.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know why variable expansion in alternate state is not working as explained?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 11:59:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expand-a-variable-in-an-alternate-state/m-p/2520735#M1226571</guid>
      <dc:creator>iliyansomlev</dc:creator>
      <dc:date>2025-06-10T11:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: expand a variable in an alternate state</title>
      <link>https://community.qlik.com/t5/QlikView/expand-a-variable-in-an-alternate-state/m-p/2520765#M1226572</link>
      <description>&lt;P&gt;I think the linked documentation with it's examples isn't clear enough to the general logic and behaviour of a variable. Better is the description on this place:&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/May2024/Subsystems/Client/Content/QV_QlikView/Scripting/dollar-sign-expansion-using-variable.htm" target="_blank"&gt;Dollar-sign expansion using a variable | QlikView Help&lt;/A&gt;&lt;/P&gt;&lt;P&gt;which makes rather clear that a variable could have always only a single value at the same time. A field could belong to n states which means that parallel to the system-table a state-table is placed but such logic isn't simply applicable to variables because there is only one value whereby the fields have n ones.&lt;/P&gt;&lt;P&gt;This means you need to apply the state within the expression or by using outer sets before the expression and this expression might be within a variable.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 15:58:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expand-a-variable-in-an-alternate-state/m-p/2520765#M1226572</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-06-10T15:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: expand a variable in an alternate state</title>
      <link>https://community.qlik.com/t5/QlikView/expand-a-variable-in-an-alternate-state/m-p/2520788#M1226573</link>
      <description>&lt;P&gt;I think the doc is wrong (typo). The state name should be outside the $. Like this:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class=""&gt;{MyState} $(vMyVar)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Or in your case,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;{PY} $(vMaxDate)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank" rel="noopener"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank" rel="noopener"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank" rel="noopener"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 22:37:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expand-a-variable-in-an-alternate-state/m-p/2520788#M1226573</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2025-06-10T22:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: expand a variable in an alternate state</title>
      <link>https://community.qlik.com/t5/QlikView/expand-a-variable-in-an-alternate-state/m-p/2520845#M1226574</link>
      <description>&lt;P&gt;Thank you for answering, unfortunately&amp;nbsp;&lt;SPAN&gt;{PY} $(vMaxDate) is not working either.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But it is not working because my variable is Global (defined as =Max(Date))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;when I make it local (Max(Date), then it is working (First is alternate state selector on 24/3, second cell is default state on 25/3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;={PY}$(vMaxDate)&amp;nbsp; &amp;nbsp; &amp;nbsp; $(vMaxDate)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#363636"&gt;&lt;STRONG&gt;&amp;nbsp;31.03.2024&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 31.03.2025&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 10:54:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/expand-a-variable-in-an-alternate-state/m-p/2520845#M1226574</guid>
      <dc:creator>iliyansomlev</dc:creator>
      <dc:date>2025-06-11T10:54:59Z</dc:date>
    </item>
  </channel>
</rss>

