<?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 Different Values for Measures Calculated in Front End vs Load Editor in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Different-Values-for-Measures-Calculated-in-Front-End-vs-Load/m-p/1829574#M9446</link>
    <description>&lt;P&gt;Hey all&lt;/P&gt;&lt;P&gt;Need some help with calculations that I want to perform in the data load editor.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been working on a data model in which the raw data comes in as a short, wide table with the measures listed as column headers. I created PKs for the dimensions and the resulting table looks similar to this generic structure, NumLines also being a measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;%contract_type, %plan_type, %Date, NumLines, Measure_1, Measure_2, Measure_3, etc.&lt;/P&gt;&lt;P&gt;Then I perform a CrossTable on this to get all measure names in the field 'Metric', and values in the field 'Value'.&lt;/P&gt;&lt;P&gt;%contract_type, %plan_type, %Date, Metric, Value&lt;/P&gt;&lt;P&gt;All of the Measure_# values need to be divide by a sum of NumLines.&lt;/P&gt;&lt;P&gt;On the front end, if i create a calculation that is: sum({$&amp;lt;Metric={'Measure_1'}&amp;gt;} Value)/sum({$&amp;lt;Metric={'lines_0'}&amp;gt;} Value)&lt;/P&gt;&lt;P&gt;I get the correct value that I am looking for. I would need to do this for all other measures as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is when I am trying to move this calculation logic to the data load editor script. Instead of including NumLines in the same CrossTable, I loaded it into its own table where I did a Sum() and Group By with all PKs. Then doing an Inner Join I get a resulting table of:&lt;/P&gt;&lt;P&gt;%contract_type, %plan_type, %Date, NumLines, Metric, Value&lt;/P&gt;&lt;P&gt;I then tried to perform the Measure/NumLines calculation here but the values I am getting are highly inflated by millions. I have tried doing:&lt;/P&gt;&lt;P&gt;Value/NumLines as PerLine&lt;/P&gt;&lt;P&gt;sum(Value/NumLines) as PerLine&lt;/P&gt;&lt;P&gt;Then on the front end i would try to do sum(PerLine) or avg(PerLine) and was not getting correct numbers regardless.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like these calculations performed in the load script because only metrics on a 'per line' basis are looked at. I basically just need to recreate the working calculation I was using in the front end with set analysis.&lt;/P&gt;&lt;P&gt;Included screenshots of my data load editor. NumLines is lines_0 and usage is an example metric I am using to test.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bsullivan28_1-1629322583858.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/60312i6BA3105E819665A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bsullivan28_1-1629322583858.png" alt="bsullivan28_1-1629322583858.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bsullivan28_0-1629322565925.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/60311iE0B643829FE33D47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bsullivan28_0-1629322565925.png" alt="bsullivan28_0-1629322565925.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Dec 2021 21:09:00 GMT</pubDate>
    <dc:creator>bsullivan28</dc:creator>
    <dc:date>2021-12-10T21:09:00Z</dc:date>
    <item>
      <title>Different Values for Measures Calculated in Front End vs Load Editor</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Different-Values-for-Measures-Calculated-in-Front-End-vs-Load/m-p/1829574#M9446</link>
      <description>&lt;P&gt;Hey all&lt;/P&gt;&lt;P&gt;Need some help with calculations that I want to perform in the data load editor.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been working on a data model in which the raw data comes in as a short, wide table with the measures listed as column headers. I created PKs for the dimensions and the resulting table looks similar to this generic structure, NumLines also being a measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;%contract_type, %plan_type, %Date, NumLines, Measure_1, Measure_2, Measure_3, etc.&lt;/P&gt;&lt;P&gt;Then I perform a CrossTable on this to get all measure names in the field 'Metric', and values in the field 'Value'.&lt;/P&gt;&lt;P&gt;%contract_type, %plan_type, %Date, Metric, Value&lt;/P&gt;&lt;P&gt;All of the Measure_# values need to be divide by a sum of NumLines.&lt;/P&gt;&lt;P&gt;On the front end, if i create a calculation that is: sum({$&amp;lt;Metric={'Measure_1'}&amp;gt;} Value)/sum({$&amp;lt;Metric={'lines_0'}&amp;gt;} Value)&lt;/P&gt;&lt;P&gt;I get the correct value that I am looking for. I would need to do this for all other measures as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is when I am trying to move this calculation logic to the data load editor script. Instead of including NumLines in the same CrossTable, I loaded it into its own table where I did a Sum() and Group By with all PKs. Then doing an Inner Join I get a resulting table of:&lt;/P&gt;&lt;P&gt;%contract_type, %plan_type, %Date, NumLines, Metric, Value&lt;/P&gt;&lt;P&gt;I then tried to perform the Measure/NumLines calculation here but the values I am getting are highly inflated by millions. I have tried doing:&lt;/P&gt;&lt;P&gt;Value/NumLines as PerLine&lt;/P&gt;&lt;P&gt;sum(Value/NumLines) as PerLine&lt;/P&gt;&lt;P&gt;Then on the front end i would try to do sum(PerLine) or avg(PerLine) and was not getting correct numbers regardless.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like these calculations performed in the load script because only metrics on a 'per line' basis are looked at. I basically just need to recreate the working calculation I was using in the front end with set analysis.&lt;/P&gt;&lt;P&gt;Included screenshots of my data load editor. NumLines is lines_0 and usage is an example metric I am using to test.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bsullivan28_1-1629322583858.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/60312i6BA3105E819665A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bsullivan28_1-1629322583858.png" alt="bsullivan28_1-1629322583858.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bsullivan28_0-1629322565925.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/60311iE0B643829FE33D47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bsullivan28_0-1629322565925.png" alt="bsullivan28_0-1629322565925.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:09:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Different-Values-for-Measures-Calculated-in-Front-End-vs-Load/m-p/1829574#M9446</guid>
      <dc:creator>bsullivan28</dc:creator>
      <dc:date>2021-12-10T21:09:00Z</dc:date>
    </item>
  </channel>
</rss>

