<?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 Actual vs Budget Scenario in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Actual-vs-Budget-Scenario/m-p/1772667#M59816</link>
    <description>&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;So here is a scenario where i am stuck. I will try to be as descriptive as possible.&lt;/P&gt;&lt;P&gt;I have two sheets. Actual and Budget. Each sheet has 5 columns: SDU, ProductName, CalenderDate, DistributionChannel and Value. Now the catch is that the Actual table gets uploaded on a daily basis whereas the Budget gets uploaded once every month.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached the sample excel workbook which has two sheets that I am using for this application.&lt;/P&gt;&lt;P&gt;MY problem: When in the front end i try to filter by product and date lets say the budget comes on the 5th Jan every month for all products. But when I am selecting any product and date say 7th Jan. It is showing Budget as zero. Ideally it should&amp;nbsp; give my the Budget value for that particular product in that&amp;nbsp; particular month irrespective of my selection.&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Actual:&lt;BR /&gt;LOAD&lt;BR /&gt;SDU,&lt;BR /&gt;ProductName,&lt;BR /&gt;CalenderDate as Date,&lt;BR /&gt;DistributionChannel,&lt;BR /&gt;"Actual Value" as Value,&lt;BR /&gt;'Actual' as vflag&lt;BR /&gt;FROM [lib://AttachedFiles/Actual vs Budget Scenario.xlsx]&lt;BR /&gt;(ooxml, embedded labels, table is Actual);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Concatenate&lt;BR /&gt;LOAD&lt;BR /&gt;SDU,&lt;BR /&gt;ProductName,&lt;BR /&gt;CalenderDate as Date,&lt;BR /&gt;DistributionChannel,&lt;BR /&gt;"Budget Value" as Value,&lt;BR /&gt;'Budget' as vflag&lt;BR /&gt;&lt;BR /&gt;FROM [lib://AttachedFiles/Actual vs Budget Scenario.xlsx]&lt;BR /&gt;(ooxml, embedded labels, table is Budget);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MinMax:&lt;BR /&gt;LOAD&lt;BR /&gt;Date(min(Date),'DD/MM/YY') as MinDate,&lt;BR /&gt;Date(Max(Date),'DD/MM/YY') as MaxDate&lt;BR /&gt;Resident Actual;&lt;/P&gt;&lt;P&gt;Let varMinDate = Num(Peek('MinDate',-1,'MinMax'));&lt;BR /&gt;Let varMaxDate = Num(Peek('MaxDate',-1,'MinMax'));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Drop Table MinMax;&lt;BR /&gt;//*********Creating table Master_Calender****************&lt;BR /&gt;Master_Calendar:&lt;BR /&gt;Load&lt;BR /&gt;*,&lt;BR /&gt;TempDate as Date,&lt;BR /&gt;Month(TempDate) as Month,&lt;BR /&gt;Year(TempDate) as Year;&lt;BR /&gt;//QuarterName(TempDate) as Quarter,&lt;BR /&gt;//'Quarter - ' &amp;amp; Ceil(Month(TempDate)/3) AS Quarter_No;&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;Date($(varMinDate) + (IterNo()-1),'DD/MM/YYYY') as TempDate&lt;/P&gt;&lt;P&gt;AutoGenerate 1&lt;/P&gt;&lt;P&gt;While Date($(varMinDate) + (IterNo()-1)) &amp;lt;= Date($(varMaxDate));&lt;/P&gt;&lt;P&gt;Drop Field TempDate&lt;BR /&gt;From Master_Calendar;&lt;/P&gt;&lt;P&gt;End Script;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the front end expression that i used to get Budget and Actual value is:&amp;nbsp;Sum({&amp;lt;vflag={'Actual'}&amp;gt;}Value&lt;/P&gt;&lt;P&gt;and&amp;nbsp;Sum({&amp;lt;vflag={'Budget'}&amp;gt;}Value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a snap of my front end:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ritvik4BI_0-1610045950101.png" style="width: 769px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/46580i41A87545143DDD09/image-dimensions/769x377?v=v2" width="769" height="377" role="button" title="ritvik4BI_0-1610045950101.png" alt="ritvik4BI_0-1610045950101.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like here i am selecting Product as Notebook and date as 6th jan. The Actual Value is correct. Budget value it should show me 3000 but is showing. Refer to excel attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your feedback is highly appreciated.&lt;/P&gt;&lt;P&gt;Thanks and Regards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2021 19:09:06 GMT</pubDate>
    <dc:creator>ritvik4BI</dc:creator>
    <dc:date>2021-01-07T19:09:06Z</dc:date>
    <item>
      <title>Actual vs Budget Scenario</title>
      <link>https://community.qlik.com/t5/App-Development/Actual-vs-Budget-Scenario/m-p/1772667#M59816</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;So here is a scenario where i am stuck. I will try to be as descriptive as possible.&lt;/P&gt;&lt;P&gt;I have two sheets. Actual and Budget. Each sheet has 5 columns: SDU, ProductName, CalenderDate, DistributionChannel and Value. Now the catch is that the Actual table gets uploaded on a daily basis whereas the Budget gets uploaded once every month.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached the sample excel workbook which has two sheets that I am using for this application.&lt;/P&gt;&lt;P&gt;MY problem: When in the front end i try to filter by product and date lets say the budget comes on the 5th Jan every month for all products. But when I am selecting any product and date say 7th Jan. It is showing Budget as zero. Ideally it should&amp;nbsp; give my the Budget value for that particular product in that&amp;nbsp; particular month irrespective of my selection.&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Actual:&lt;BR /&gt;LOAD&lt;BR /&gt;SDU,&lt;BR /&gt;ProductName,&lt;BR /&gt;CalenderDate as Date,&lt;BR /&gt;DistributionChannel,&lt;BR /&gt;"Actual Value" as Value,&lt;BR /&gt;'Actual' as vflag&lt;BR /&gt;FROM [lib://AttachedFiles/Actual vs Budget Scenario.xlsx]&lt;BR /&gt;(ooxml, embedded labels, table is Actual);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Concatenate&lt;BR /&gt;LOAD&lt;BR /&gt;SDU,&lt;BR /&gt;ProductName,&lt;BR /&gt;CalenderDate as Date,&lt;BR /&gt;DistributionChannel,&lt;BR /&gt;"Budget Value" as Value,&lt;BR /&gt;'Budget' as vflag&lt;BR /&gt;&lt;BR /&gt;FROM [lib://AttachedFiles/Actual vs Budget Scenario.xlsx]&lt;BR /&gt;(ooxml, embedded labels, table is Budget);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MinMax:&lt;BR /&gt;LOAD&lt;BR /&gt;Date(min(Date),'DD/MM/YY') as MinDate,&lt;BR /&gt;Date(Max(Date),'DD/MM/YY') as MaxDate&lt;BR /&gt;Resident Actual;&lt;/P&gt;&lt;P&gt;Let varMinDate = Num(Peek('MinDate',-1,'MinMax'));&lt;BR /&gt;Let varMaxDate = Num(Peek('MaxDate',-1,'MinMax'));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Drop Table MinMax;&lt;BR /&gt;//*********Creating table Master_Calender****************&lt;BR /&gt;Master_Calendar:&lt;BR /&gt;Load&lt;BR /&gt;*,&lt;BR /&gt;TempDate as Date,&lt;BR /&gt;Month(TempDate) as Month,&lt;BR /&gt;Year(TempDate) as Year;&lt;BR /&gt;//QuarterName(TempDate) as Quarter,&lt;BR /&gt;//'Quarter - ' &amp;amp; Ceil(Month(TempDate)/3) AS Quarter_No;&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;Date($(varMinDate) + (IterNo()-1),'DD/MM/YYYY') as TempDate&lt;/P&gt;&lt;P&gt;AutoGenerate 1&lt;/P&gt;&lt;P&gt;While Date($(varMinDate) + (IterNo()-1)) &amp;lt;= Date($(varMaxDate));&lt;/P&gt;&lt;P&gt;Drop Field TempDate&lt;BR /&gt;From Master_Calendar;&lt;/P&gt;&lt;P&gt;End Script;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the front end expression that i used to get Budget and Actual value is:&amp;nbsp;Sum({&amp;lt;vflag={'Actual'}&amp;gt;}Value&lt;/P&gt;&lt;P&gt;and&amp;nbsp;Sum({&amp;lt;vflag={'Budget'}&amp;gt;}Value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a snap of my front end:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ritvik4BI_0-1610045950101.png" style="width: 769px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/46580i41A87545143DDD09/image-dimensions/769x377?v=v2" width="769" height="377" role="button" title="ritvik4BI_0-1610045950101.png" alt="ritvik4BI_0-1610045950101.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like here i am selecting Product as Notebook and date as 6th jan. The Actual Value is correct. Budget value it should show me 3000 but is showing. Refer to excel attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your feedback is highly appreciated.&lt;/P&gt;&lt;P&gt;Thanks and Regards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 19:09:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Actual-vs-Budget-Scenario/m-p/1772667#M59816</guid>
      <dc:creator>ritvik4BI</dc:creator>
      <dc:date>2021-01-07T19:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Actual vs Budget Scenario</title>
      <link>https://community.qlik.com/t5/App-Development/Actual-vs-Budget-Scenario/m-p/1772703#M59819</link>
      <description>&lt;P&gt;You could achieve this with this expression:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Sum(total &amp;lt;DistributionChannel, ProductName&amp;gt; {&amp;lt;Date, Month={'$(=month(Date))'},Year={$(=year(Date))}, vflag={'Budget'}&amp;gt;}Value)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Have you considered remodelling your data model? You could make these calculations easier linked your transaction to a calendar using intervalmatch().&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Vegar_0-1610051691786.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/46596i50FF1C867BB22196/image-size/large?v=v2&amp;amp;px=999" role="button" title="Vegar_0-1610051691786.png" alt="Vegar_0-1610051691786.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Actual:
LOAD
SDU,
ProductName,
CalenderDate as Date_from,
CalenderDate as Date_to,
monthname(CalenderDate) as %period,
DistributionChannel,
"Actual Value" as Value,
'Actual' as vflag
FROM [lib://Downloads/Actual vs Budget Scenario.xlsx]
(ooxml, embedded labels, table is Actual);

 

Concatenate
LOAD
SDU,
ProductName,
MonthStart(CalenderDate) as Date_from,
MonthEnd(CalenderDate) as Date_to,
DistributionChannel,
"Budget Value" as Value,
'Budget' as vflag

FROM [lib://Downloads/Actual vs Budget Scenario.xlsx]
(ooxml, embedded labels, table is Budget);

 

MinMax:
LOAD
Date(min(Date_from),'DD/MM/YY') as MinDate,
Date(Max(Date_to),'DD/MM/YY') as MaxDate
Resident Actual;

Let varMinDate = Num(Peek('MinDate',-1,'MinMax'));
Let varMaxDate = Num(Peek('MaxDate',-1,'MinMax'));


Drop Table MinMax;
//*********Creating table Master_Calender****************
Master_Calendar:
Load
TempDate as Date,
Month(TempDate) as Month,
Year(TempDate) as Year;

Load
Date($(varMinDate) + (IterNo()-1),'DD/MM/YYYY') as TempDate

AutoGenerate 1

While Date($(varMinDate) + (IterNo()-1)) &amp;lt;= Date($(varMaxDate));

IntervalMatch:
IntervalMatch([Date]) LOAD Date_from, Date_to Resident Actual; 
exit Script;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&amp;nbsp; This sample will give you an syntetic key, it will make no harm to your application but you can take means to remove it if you don't want it.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 20:35:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Actual-vs-Budget-Scenario/m-p/1772703#M59819</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2021-01-07T20:35:07Z</dc:date>
    </item>
  </channel>
</rss>

