<?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 How can I create a dynamic viz for non-additive measures? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-can-I-create-a-dynamic-viz-for-non-additive-measures/m-p/2117261#M91149</link>
    <description>&lt;P&gt;I have a table that shows the daily product stock for each product, customer segment etc. something like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;product&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Segment&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Opening Stock&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Closing Stock&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-09-14&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Product A&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;segment x&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;15&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-09-14&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Product B&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;segment x&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;5&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-09-15&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Product A&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;segment x&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;18&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;17&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-09-15&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Product B&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;segment x&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;5&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the users want to analyse this data on a variety of date aggregations (weekly, monthly, quarterly etc.), so I want to have the option to select different granularities. The issue I am having is that since this is an non-additive measure I can't just add sum() and call it a day, but rather for each date selection I want to show the stock at the opening of the selection and end of selection.&lt;/P&gt;
&lt;P&gt;For total kpi values this is not an issue since it's just a set of &amp;lt;date = {$(max/min(date))}&amp;gt; , but I can't figure out how to do it in more dynamic objects such as the Vizlib custom report.&lt;/P&gt;
&lt;P&gt;What I want to achieve:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;If a user selects Year-Week, opening stock, closing stock,&amp;nbsp;&lt;/STRONG&gt;the opening stock should show stock at the first date of the week, and closing stock on the end of the week, for each week visible in the object.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;If a user selects Year-Month, opening stock, closing stock,&lt;/STRONG&gt; the opening stock should show stock at day 1 of the month, and closing stock should show at the last day of the month, for each year-month visible.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Something like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Year-Week&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Opening Stock (take from 2023-01-02, 2023-01-09 etc.)&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Closing Stock (take from 2023-01-08, 2023-01-15 etc.)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-01&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-02&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;3&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-03&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-04&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;7&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for year month it would be&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="62px"&gt;Year-Month&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="62px"&gt;
&lt;P&gt;Opening Stock (take from 2023-01-01, 2023-02-01&amp;nbsp;etc.)&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="62px"&gt;Closing Stock (take from 2023-01-31, 2023-01-28 etc.)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-01&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-02&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-03&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;15&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;21&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-04&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;21&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;20&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-PRODUCT title="Qlik Sense Business" id="qlikSenseBusiness"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Sep 2023 08:32:38 GMT</pubDate>
    <dc:creator>simon20</dc:creator>
    <dc:date>2023-09-15T08:32:38Z</dc:date>
    <item>
      <title>How can I create a dynamic viz for non-additive measures?</title>
      <link>https://community.qlik.com/t5/App-Development/How-can-I-create-a-dynamic-viz-for-non-additive-measures/m-p/2117261#M91149</link>
      <description>&lt;P&gt;I have a table that shows the daily product stock for each product, customer segment etc. something like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;product&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Segment&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Opening Stock&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="47px"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Closing Stock&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-09-14&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Product A&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;segment x&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;15&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;18&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-09-14&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Product B&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;segment x&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;5&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-09-15&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Product A&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;segment x&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;18&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;17&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-09-15&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Product B&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="25px"&gt;segment x&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;5&lt;/TD&gt;
&lt;TD width="8.333333333333334%" height="25px"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the users want to analyse this data on a variety of date aggregations (weekly, monthly, quarterly etc.), so I want to have the option to select different granularities. The issue I am having is that since this is an non-additive measure I can't just add sum() and call it a day, but rather for each date selection I want to show the stock at the opening of the selection and end of selection.&lt;/P&gt;
&lt;P&gt;For total kpi values this is not an issue since it's just a set of &amp;lt;date = {$(max/min(date))}&amp;gt; , but I can't figure out how to do it in more dynamic objects such as the Vizlib custom report.&lt;/P&gt;
&lt;P&gt;What I want to achieve:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;If a user selects Year-Week, opening stock, closing stock,&amp;nbsp;&lt;/STRONG&gt;the opening stock should show stock at the first date of the week, and closing stock on the end of the week, for each week visible in the object.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;If a user selects Year-Month, opening stock, closing stock,&lt;/STRONG&gt; the opening stock should show stock at day 1 of the month, and closing stock should show at the last day of the month, for each year-month visible.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Something like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Year-Week&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Opening Stock (take from 2023-01-02, 2023-01-09 etc.)&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;Closing Stock (take from 2023-01-08, 2023-01-15 etc.)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-01&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-02&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;3&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-03&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-04&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;7&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for year month it would be&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="62px"&gt;Year-Month&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="62px"&gt;
&lt;P&gt;Opening Stock (take from 2023-01-01, 2023-02-01&amp;nbsp;etc.)&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="62px"&gt;Closing Stock (take from 2023-01-31, 2023-01-28 etc.)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-01&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-02&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-03&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;15&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;21&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;2023-04&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;21&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;20&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-PRODUCT title="Qlik Sense Business" id="qlikSenseBusiness"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 08:32:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-can-I-create-a-dynamic-viz-for-non-additive-measures/m-p/2117261#M91149</guid>
      <dc:creator>simon20</dc:creator>
      <dc:date>2023-09-15T08:32:38Z</dc:date>
    </item>
  </channel>
</rss>

