<?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 Why is my expression not working in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Why-is-my-expression-not-working/m-p/1880493#M1216824</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please help me why my code is not working on expressions&lt;/P&gt;
&lt;P&gt;Below is my code on expressions&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=sum(if(om_daily.txn_week = &lt;U&gt;&lt;STRONG&gt;Num(year(Today(1)-1)&amp;amp;Right(concat('00'&amp;amp;(Week(Today(1)-1)-1)),2))&lt;/STRONG&gt;&lt;/U&gt; and om_daily.metric_type = 'WEEKLY',om_daily.active_mx)/1000)&lt;/P&gt;
&lt;P&gt;Below code working fine when i am giving direct condition for YYYYWW&lt;/P&gt;
&lt;P&gt;=sum(if(om_daily.txn_week = &lt;U&gt;&lt;STRONG&gt;'202202'&lt;/STRONG&gt;&lt;/U&gt; and om_daily.metric_type = 'WEEKLY',om_daily.active_mx)/1000)&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jan 2022 07:56:48 GMT</pubDate>
    <dc:creator>MohdRizwan</dc:creator>
    <dc:date>2022-01-13T07:56:48Z</dc:date>
    <item>
      <title>Why is my expression not working</title>
      <link>https://community.qlik.com/t5/QlikView/Why-is-my-expression-not-working/m-p/1880493#M1216824</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please help me why my code is not working on expressions&lt;/P&gt;
&lt;P&gt;Below is my code on expressions&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=sum(if(om_daily.txn_week = &lt;U&gt;&lt;STRONG&gt;Num(year(Today(1)-1)&amp;amp;Right(concat('00'&amp;amp;(Week(Today(1)-1)-1)),2))&lt;/STRONG&gt;&lt;/U&gt; and om_daily.metric_type = 'WEEKLY',om_daily.active_mx)/1000)&lt;/P&gt;
&lt;P&gt;Below code working fine when i am giving direct condition for YYYYWW&lt;/P&gt;
&lt;P&gt;=sum(if(om_daily.txn_week = &lt;U&gt;&lt;STRONG&gt;'202202'&lt;/STRONG&gt;&lt;/U&gt; and om_daily.metric_type = 'WEEKLY',om_daily.active_mx)/1000)&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 07:56:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-is-my-expression-not-working/m-p/1880493#M1216824</guid>
      <dc:creator>MohdRizwan</dc:creator>
      <dc:date>2022-01-13T07:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my expression not working</title>
      <link>https://community.qlik.com/t5/QlikView/Why-is-my-expression-not-working/m-p/1880511#M1216830</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/161961"&gt;@MohdRizwan&lt;/a&gt;&amp;nbsp; can you check&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;=Num(year(Today(1)-1)&amp;amp;Right(concat('00'&amp;amp;(Week(Today(1)-1)-1)),2)) &lt;/LI-CODE&gt;
&lt;P&gt;gives&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Taoufiq_Zarra_0-1642063864719.png"&gt;&lt;img src="https://community.qlik.com/skins/images/68186FF59415FE3F2BA91703C2AE6652/responsive_peak/images/image_not_found.png" alt="Taoufiq_Zarra_0-1642063864719.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;but if i understood correctly you need &lt;U&gt;&lt;STRONG&gt;202202&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 08:51:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-is-my-expression-not-working/m-p/1880511#M1216830</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2022-01-13T08:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my expression not working</title>
      <link>https://community.qlik.com/t5/QlikView/Why-is-my-expression-not-working/m-p/1880520#M1216831</link>
      <description>&lt;P&gt;There are multiple issues. Your combining of numbers with &amp;amp; returned a string and the same happens if&amp;nbsp; you applies string-functions like right() - which num() couldn't format. Further you used here concat() which is an aggregation-function and not designed to combine strings. Therefore you may try it in this way:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sum({&amp;lt; om_daily.txn_week =&amp;nbsp;&lt;/SPAN&gt;&lt;U&gt;&lt;STRONG&gt;{"$(=date(today(), 'YYYYWW'))"}&lt;/STRONG&gt;&lt;/U&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;om_daily.metric_type = {'WEEKLY'}&amp;gt;} om_daily.active_mx) / 1000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;which simplifies the approach to create the right year-week and used set analysis instead an if-loop which is much more flexible and performant. Depending on your used week-number-system (starting when with which number ...) you may need some adjustment to add 1 or -1 or you tries it with another function like:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;replace(weekname(today()), '/', ''). &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I suggest just to play with the week-expressions within a separate textbox to see which one returned which result.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- Marcus&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 09:02:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-is-my-expression-not-working/m-p/1880520#M1216831</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-01-13T09:02:35Z</dc:date>
    </item>
  </channel>
</rss>

