<?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: Combing data from two resources based on %distribution in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Combing-data-from-two-resources-based-on-distribution/m-p/2068800#M87661</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/58578"&gt;@edwin&lt;/a&gt;&amp;nbsp; Thanks for the reply.&lt;/P&gt;
&lt;P&gt;The whole issue is that I want the users to analyze by month and a couple of other filters in the dashboard. That's what's causing the issue that I described.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 May 2023 16:24:23 GMT</pubDate>
    <dc:creator>AB108</dc:creator>
    <dc:date>2023-05-08T16:24:23Z</dc:date>
    <item>
      <title>Combing data from two resources based on %distribution</title>
      <link>https://community.qlik.com/t5/App-Development/Combing-data-from-two-resources-based-on-distribution/m-p/2067454#M87568</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Attaching sample data for this problem.&lt;/P&gt;
&lt;P&gt;I am trying to combine Sales and Expense data. Sales data is straight forward. Expenses for each customer are calculated by different KPIs like for this sample it is percentage of their contribution to total sales from that particular site. This contribution has to be calculated in the dashboard based on various dynamic filters example date.&lt;/P&gt;
&lt;P&gt;I am able to achieve this if I try to keep the site in the list box. Similarly if I try to filter on customer from a list box , the expense data goes blank.&lt;/P&gt;
&lt;P&gt;Would appreciate some help regarding a more efficient way to script this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 22:03:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combing-data-from-two-resources-based-on-distribution/m-p/2067454#M87568</guid>
      <dc:creator>AB108</dc:creator>
      <dc:date>2023-05-03T22:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Combing data from two resources based on %distribution</title>
      <link>https://community.qlik.com/t5/App-Development/Combing-data-from-two-resources-based-on-distribution/m-p/2068190#M87610</link>
      <description>&lt;P&gt;is addresses your specific question:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;load * inline [
Site,Customer,Sale Date,Sales
A,abc,Jan-23,200
A,bcd,Feb-23,100
A,cde,Mar-23,500
A,abc,Feb-23,800
A,bcd,Jan-23,100
A,cde,Mar-23,300
A,ghi,Mar-23,200
B,abc,Jan-23,500
B,bcd,Jan-23,900
B,cde,Feb-23,300
B,abc,Mar-23,200
B,bcd,Jan-23,600
B,cde,Jan-23,700
B,hij,Feb-23,900
];


load * inline [
Site,Expense Date,Labor,Maintenance,Fuel,Other,Total Expenses
A,Jan-23,50,10,20,10,90
A,Feb-23,60,10,20,10,100
A,Mar-23,70,10,20,10,110
B,Jan-23,80,10,20,10,120
B,Feb-23,90,10,20,10,130
B,Mar-23,100,10,20,10,140
];&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="edwin_0-1683291876316.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106556i55EA95D3FBA68DEB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="edwin_0-1683291876316.png" alt="edwin_0-1683291876316.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;note that i changed the names of the dates to prevent synth keys.&amp;nbsp; the solution really is to aggregate by site.&lt;/P&gt;
&lt;P&gt;however, you may have a larger problem, you may want to allow the users to select months and analyze the perfromances by month.&amp;nbsp; that is a different discussion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 13:06:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combing-data-from-two-resources-based-on-distribution/m-p/2068190#M87610</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2023-05-05T13:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Combing data from two resources based on %distribution</title>
      <link>https://community.qlik.com/t5/App-Development/Combing-data-from-two-resources-based-on-distribution/m-p/2068800#M87661</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/58578"&gt;@edwin&lt;/a&gt;&amp;nbsp; Thanks for the reply.&lt;/P&gt;
&lt;P&gt;The whole issue is that I want the users to analyze by month and a couple of other filters in the dashboard. That's what's causing the issue that I described.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 16:24:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combing-data-from-two-resources-based-on-distribution/m-p/2068800#M87661</guid>
      <dc:creator>AB108</dc:creator>
      <dc:date>2023-05-08T16:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combing data from two resources based on %distribution</title>
      <link>https://community.qlik.com/t5/App-Development/Combing-data-from-two-resources-based-on-distribution/m-p/2068912#M87671</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/135828"&gt;@AB108&lt;/a&gt;&amp;nbsp; Create a composite Key between both the tables. Consider Sales table as your driving table as it is actual transaction tale. Create master calendar using Sales Date and also use Sales Site as Site Dimension&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;load Site ,
    Customer, 
    Date ,
    Sales, 
    Site&amp;amp;floor(Date#(Date,'MMM-YY')) as key 
inline [
Site,Customer, Date,Sales
A,abc,Jan-23,200
A,bcd,Feb-23,100
A,cde,Mar-23,500
A,abc,Feb-23,800
A,bcd,Jan-23,100
A,cde,Mar-23,300
A,ghi,Mar-23,200
B,abc,Jan-23,500
B,bcd,Jan-23,900
B,cde,Feb-23,300
B,abc,Mar-23,200
B,bcd,Jan-23,600
B,cde,Jan-23,700
B,hij,Feb-23,900
];


load Site as Expense_Site,
     Date as Expense_Date,
     Labor,
     Site&amp;amp;floor(Date#(Date,'MMM-YY')) as key ,
     Maintenance,
     Fuel,
     Other,
     [Total Expenses] 
inline [
Site,Date,Labor,Maintenance,Fuel,Other,Total Expenses
A,Jan-23,50,10,20,10,90
A,Feb-23,60,10,20,10,100
A,Mar-23,70,10,20,10,110
B,Jan-23,80,10,20,10,120
B,Feb-23,90,10,20,10,130
B,Mar-23,100,10,20,10,140
];

Autonumber Key;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now create a table with below dimension and measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Dimensions:
Site
Customer

Expressions:
1) Sales: 
=Sum(Sales)

2) Expenses: 
=sum(aggr((sum({&amp;lt;Customer=&amp;gt;}Sales)/ Sum(total &amp;lt;Site&amp;gt;{&amp;lt;Customer=&amp;gt;}Sales))*Sum(total &amp;lt;Site&amp;gt;{&amp;lt;Customer=&amp;gt;}[Total Expenses]),
Site,Customer))
Note: If you add more dimensions to your table, you need to exclude those dimensions in all set expressions and also add it to aggr functions

3) Column(1)-Column(2) 
// Column(1)-Sales Measure Number (1st Measure)
// Column(2)-Expense Measure Number (2nd Measure)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 23:19:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combing-data-from-two-resources-based-on-distribution/m-p/2068912#M87671</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-08T23:19:10Z</dc:date>
    </item>
  </channel>
</rss>

