<?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: row-level modification of class() expression (class([Field]*x,...), where x depends on another field) in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/row-level-modification-of-class-expression-class-Field-x-where-x/m-p/2140299#M92708</link>
    <description>&lt;P&gt;Thanks for your reply!&lt;/P&gt;
&lt;P&gt;I have tried that, still doesn't work. Played around with aggr() quite a lot, but found no solution.&lt;/P&gt;
&lt;P&gt;I now have also tried to do the same chart as a Vizlib Bar Chart. And there, the original term simply works. No aggr() or any other adaptions needed. However, the Vizlib chart has other restrictions, so I would still prefer to use the normal Bar Chart.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2023 12:35:05 GMT</pubDate>
    <dc:creator>MB_</dc:creator>
    <dc:date>2023-11-22T12:35:05Z</dc:date>
    <item>
      <title>row-level modification of class() expression (class([Field]*x,...), where x depends on another field)</title>
      <link>https://community.qlik.com/t5/App-Development/row-level-modification-of-class-expression-class-Field-x-where-x/m-p/2139522#M92621</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I am trying to build a bar chart using class(). The simplified version already works and is basically designed like this:&lt;/P&gt;
&lt;P&gt;Dimensions:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Stack: class([Price], $(vBucketSize))&lt;/LI&gt;
&lt;LI&gt;Bars: [Brand]&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Length of Bars: Sum([Volume])&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Now I want to be able to modify the prices of some brands for simulations. For that, I introduced two more variables that can be set by the user:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;vBrand&lt;/LI&gt;
&lt;LI&gt;vMultiplier&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Let’s assume vBrand is 'BrandA' and vMultiplier is 0.5, then I want to show the prices of BrandA reduced by 50%, and all other brands with their original prices.&lt;/P&gt;
&lt;P&gt;To incorporate this in the bar chart, I tried to modify the Stack expression:&lt;/P&gt;
&lt;P&gt;class([Price] &lt;STRONG&gt;* pick(wildmatch([Brand], '$(vBrand)' + 1, 1, $(vMultiplier))&lt;/STRONG&gt;, $(vBucketSize))&lt;/P&gt;
&lt;P&gt;This term works just fine in all other charts I use in my app, only the bar chart with class() refuses to work. It seems to me that a row-level modification in the first parameter of class() is not possible!? I can multiply with a single factor like class([Price]*0.5, $(vBucketSize)) which changes all prices, but as soon as I try to adapt the multiplication based on a field, I always get: &lt;EM&gt;The chart is not displayed because it contains only undefined values.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I would really appreciate any help.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Exemplary data:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;Brand&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;Price&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;Volume&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;BrandA&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;90&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;24&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;BrandA&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;120&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;12&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;BrandB&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="39px"&gt;
&lt;P&gt;50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="201px" height="36px"&gt;
&lt;P&gt;BrandC&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="36px"&gt;
&lt;P&gt;80&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="201px" height="36px"&gt;
&lt;P&gt;40&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S.:&lt;/P&gt;
&lt;P&gt;I am using pick(wildmatch()) and not a simple if(), because I want to be able to add more variables for brands &amp;amp; multipliers, like vBrand1, vBrand2, … However, I also tested this with a simple *if([Brand]='$(vBrand)', $(vMultiplier), 1) and got the same results.&lt;/P&gt;
&lt;P&gt;The +1 at the end of wildmatch is to make sure that all brands that are not selected for vBrand are multiplied by 1 (i.e., no change to their prices).&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 18:33:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/row-level-modification-of-class-expression-class-Field-x-where-x/m-p/2139522#M92621</guid>
      <dc:creator>MB_</dc:creator>
      <dc:date>2023-11-20T18:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: row-level modification of class() expression (class([Field]*x,...), where x depends on another field)</title>
      <link>https://community.qlik.com/t5/App-Development/row-level-modification-of-class-expression-class-Field-x-where-x/m-p/2140283#M92706</link>
      <description>&lt;P&gt;I assume you missed respectively (intentionally) skipped Brand as dimension within the bar-chart. Without it as dimension the call of Brand and/or Price without using an aggregation will return NULL. In this case you will need to add the wanted dimensionality to your calculated dimension, maybe with something like this:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;class(&lt;STRONG&gt;aggr(&lt;/STRONG&gt;[Price]&amp;nbsp;&lt;/SPAN&gt;* pick(wildmatch([Brand], '$(vBrand)' + 1, 1, $(vMultiplier))&lt;SPAN&gt;, &lt;STRONG&gt;Brand)&lt;/STRONG&gt;, $(vBucketSize))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 12:09:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/row-level-modification-of-class-expression-class-Field-x-where-x/m-p/2140283#M92706</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-11-22T12:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: row-level modification of class() expression (class([Field]*x,...), where x depends on another field)</title>
      <link>https://community.qlik.com/t5/App-Development/row-level-modification-of-class-expression-class-Field-x-where-x/m-p/2140299#M92708</link>
      <description>&lt;P&gt;Thanks for your reply!&lt;/P&gt;
&lt;P&gt;I have tried that, still doesn't work. Played around with aggr() quite a lot, but found no solution.&lt;/P&gt;
&lt;P&gt;I now have also tried to do the same chart as a Vizlib Bar Chart. And there, the original term simply works. No aggr() or any other adaptions needed. However, the Vizlib chart has other restrictions, so I would still prefer to use the normal Bar Chart.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 12:35:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/row-level-modification-of-class-expression-class-Field-x-where-x/m-p/2140299#M92708</guid>
      <dc:creator>MB_</dc:creator>
      <dc:date>2023-11-22T12:35:05Z</dc:date>
    </item>
  </channel>
</rss>

