<?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: Combining fields from other QVD + generate master/shared calendar for filtering in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529574#M107712</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/135319"&gt;@Daryn&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Great, here's the simplified script pattern you can adapt. I'm trying to enrich Sales data with correct order values from VBAK and VBKD; then build a master calendar that covers both order and invoice dates. It's hard to test without the files, but I hope it helps! I ran it on ChatGPT for additional checks. Here it is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// Qlik Script — Enrich Sales_data with VBAK/VBKD + Shared Calendar&lt;BR /&gt;// Final version (single block). Adjust lib paths/field names as needed.&lt;BR /&gt;// ======================================================&lt;/P&gt;&lt;P&gt;// Keep numeric parsing consistent&lt;BR /&gt;SET DecimalSep='.';&lt;BR /&gt;SET MoneyDecimalSep='.';&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// 1) LOOKUPS (MAPPING LOADS) FROM VBAK / VBKD&lt;BR /&gt;// Use ApplyMap() later to avoid big joins and row explosion.&lt;BR /&gt;// ======================================================&lt;/P&gt;&lt;P&gt;// VBAK: header net value (NETWR) per order&lt;BR /&gt;VBAK_Map_NETWR:&lt;BR /&gt;MAPPING&lt;BR /&gt;LOAD&lt;BR /&gt;NUM(NUM#(VBELN,'#0')) AS order_no,&lt;BR /&gt;Round(Num#(NETWR,'#.#############'),0.01) AS NETWR_hdr&lt;BR /&gt;FROM [lib://QVD-Generator/VBAK.qvd] (qvd)&lt;BR /&gt;WHERE fabs(Num#(NETWR,'#.#############')) &amp;gt;= 0.005;&lt;/P&gt;&lt;P&gt;// VBAK: header currency (WAERK) per order&lt;BR /&gt;VBAK_Map_WAERK:&lt;BR /&gt;MAPPING&lt;BR /&gt;LOAD&lt;BR /&gt;NUM(NUM#(VBELN,'#0')) AS order_no,&lt;BR /&gt;WAERK AS WAERK_hdr&lt;BR /&gt;FROM [lib://QVD-Generator/VBAK.qvd] (qvd);&lt;/P&gt;&lt;P&gt;// VBKD: normalize KURSK and aggregate one rate per order&lt;BR /&gt;VBKD_Pre:&lt;BR /&gt;LOAD&lt;BR /&gt;NUM(NUM#(VBELN,'#0')) AS order_no,&lt;BR /&gt;Num#(Replace(KURSK,',','.'),'0.0000') AS KURSK_norm&lt;BR /&gt;FROM [lib://QVD-Generator/VBKD.qvd] (qvd);&lt;/P&gt;&lt;P&gt;VBKD_KURSK_Map:&lt;BR /&gt;MAPPING&lt;BR /&gt;LOAD&lt;BR /&gt;order_no,&lt;BR /&gt;Max(KURSK_norm) AS KURSK_order&lt;BR /&gt;RESIDENT VBKD_Pre&lt;BR /&gt;GROUP BY order_no;&lt;/P&gt;&lt;P&gt;DROP TABLE VBKD_Pre;&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// 2) FACT LOAD: SALES_DATA ➜ ENRICH &amp;amp; SAFE CALCS&lt;BR /&gt;// No self-joins. Compute with ApplyMap() in a derived RESIDENT load.&lt;BR /&gt;// ======================================================&lt;/P&gt;&lt;P&gt;Sales_data:&lt;BR /&gt;LOAD&lt;BR /&gt;VKORG,&lt;BR /&gt;NUM(NUM#(order_no,'#0')) AS order_no,&lt;BR /&gt;order_pos,&lt;BR /&gt;material_no,&lt;BR /&gt;material_name,&lt;BR /&gt;quantity_order,&lt;BR /&gt;price_per_unit,&lt;BR /&gt;unit,&lt;BR /&gt;document_type,&lt;BR /&gt;accounting_type,&lt;BR /&gt;VTWEG,&lt;BR /&gt;Date(order_date) AS order_date,&lt;BR /&gt;sales_office,&lt;BR /&gt;VKBUR,&lt;/P&gt;&lt;P&gt;NUM(NUM#(invoice_no,'#0')) AS invoice_no,&lt;BR /&gt;invoice_pos,&lt;BR /&gt;Date(invoice_date) AS invoice_date,&lt;BR /&gt;quantity_invoice,&lt;BR /&gt;WAERK_invoice,&lt;BR /&gt;KURRF_invoice,&lt;BR /&gt;// Include if exists in QVD; otherwise amountLC_invoice will be null (safe):&lt;BR /&gt;NETWR_invoice,&lt;/P&gt;&lt;P&gt;// Other descriptive fields&lt;BR /&gt;quote_no,&lt;BR /&gt;quote_pos,&lt;BR /&gt;quantity_quote,&lt;BR /&gt;Mid(AG_customer,4,11) AS Customer_Number,&lt;BR /&gt;Mid(AG_customer,16,30) AS Customer_Name,&lt;BR /&gt;intercompany,&lt;BR /&gt;export,&lt;BR /&gt;AG_country,&lt;BR /&gt;AG_country_name,&lt;BR /&gt;WE_country,&lt;BR /&gt;EU_zone,&lt;BR /&gt;currency,&lt;BR /&gt;customer_order_no&lt;BR /&gt;FROM [lib://QVD-Generator/Sales_data.qvd] (qvd);&lt;/P&gt;&lt;P&gt;// Derive enriched fields (no joins)&lt;BR /&gt;Sales_data_fixed:&lt;BR /&gt;NOCONCATENATE&lt;BR /&gt;LOAD&lt;BR /&gt;*,&lt;BR /&gt;// Lookups via ApplyMap (header net/currency/rate per order)&lt;BR /&gt;ApplyMap('VBAK_Map_NETWR', order_no, Null()) AS NETWR_hdr,&lt;BR /&gt;ApplyMap('VBAK_Map_WAERK', order_no, Null()) AS WAERK_hdr,&lt;BR /&gt;ApplyMap('VBKD_KURSK_Map', order_no, 0) AS KURSK_order,&lt;/P&gt;&lt;P&gt;// Corrected ORDER amount in local currency&lt;BR /&gt;// ⚠ Verify KURSK direction in your SAP extract and flip * vs / if needed.&lt;BR /&gt;Round(&lt;BR /&gt;Num(&lt;BR /&gt;If(WAERK_hdr='GBP', NETWR_hdr,&lt;BR /&gt;If(WAERK_hdr='EUR', NETWR_hdr * KURSK_order,&lt;BR /&gt;If(WAERK_hdr='USD' and KURSK_order&amp;lt;&amp;gt;0, NETWR_hdr / fabs(KURSK_order),&lt;BR /&gt;Null())))&lt;BR /&gt;,'#.#############')&lt;BR /&gt;,0.01) AS amountLC_order,&lt;/P&gt;&lt;P&gt;// INVOICE amount in local currency (guard for missing inputs)&lt;BR /&gt;Round(&lt;BR /&gt;Num(&lt;BR /&gt;If(WAERK_invoice='GBP' and IsNum(NETWR_invoice), NETWR_invoice,&lt;BR /&gt;If(WAERK_invoice='EUR' and IsNum(NETWR_invoice) and IsNum(KURRF_invoice), NETWR_invoice * KURRF_invoice,&lt;BR /&gt;If(WAERK_invoice='USD' and IsNum(NETWR_invoice) and IsNum(KURRF_invoice) and KURRF_invoice&amp;lt;&amp;gt;0, NETWR_invoice * KURRF_invoice,&lt;BR /&gt;Null())))&lt;BR /&gt;,'#.#############')&lt;BR /&gt;,0.01) AS amountLC_invoice,&lt;/P&gt;&lt;P&gt;// Calendar keys (one per business date type)&lt;BR /&gt;Hash128(NUM(order_no), 'Order') AS %CalendarKey_Order,&lt;BR /&gt;Hash128(NUM(invoice_no), 'Invoice') AS %CalendarKey_Invoice&lt;/P&gt;&lt;P&gt;RESIDENT Sales_data;&lt;/P&gt;&lt;P&gt;DROP TABLE Sales_data;&lt;BR /&gt;RENAME TABLE Sales_data_fixed TO Sales_data;&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// 3) SHARED / MASTER CALENDAR (supports Order + Invoice without precedence)&lt;BR /&gt;// Use two explicit bridge tables so field names match and associations work.&lt;BR /&gt;// ======================================================&lt;/P&gt;&lt;P&gt;// Normalize both business dates into a single staging source&lt;BR /&gt;CalendarSource:&lt;BR /&gt;LOAD&lt;BR /&gt;%CalendarKey_Order AS %CalendarKey,&lt;BR /&gt;Date(order_date) AS LinkDate,&lt;BR /&gt;'Order' AS DateType&lt;BR /&gt;RESIDENT Sales_data&lt;BR /&gt;WHERE not IsNull(order_date);&lt;/P&gt;&lt;P&gt;CONCATENATE (CalendarSource)&lt;BR /&gt;LOAD&lt;BR /&gt;%CalendarKey_Invoice AS %CalendarKey,&lt;BR /&gt;Date(invoice_date) AS LinkDate,&lt;BR /&gt;'Invoice' AS DateType&lt;BR /&gt;RESIDENT Sales_data&lt;BR /&gt;WHERE not IsNull(invoice_date);&lt;/P&gt;&lt;P&gt;// Build continuous date island (MasterCalendar) from min/max&lt;BR /&gt;TempMinMax:&lt;BR /&gt;LOAD&lt;BR /&gt;Min(LinkDate) AS MinDate,&lt;BR /&gt;Max(LinkDate) AS MaxDate&lt;BR /&gt;RESIDENT CalendarSource;&lt;/P&gt;&lt;P&gt;LET vMinDate = Num(Peek('MinDate',0,'TempMinMax'));&lt;BR /&gt;LET vMaxDate = Num(Peek('MaxDate',0,'TempMinMax'));&lt;BR /&gt;DROP TABLE TempMinMax;&lt;/P&gt;&lt;P&gt;MasterCalendar:&lt;BR /&gt;LOAD&lt;BR /&gt;Date($(vMinDate) + IterNo() - 1) AS LinkDate,&lt;BR /&gt;Year(Date($(vMinDate) + IterNo() - 1)) AS Year,&lt;BR /&gt;Month(Date($(vMinDate) + IterNo() - 1)) AS Month,&lt;BR /&gt;Dual(Year(Date($(vMinDate)+IterNo()-1)) &amp;amp; '-' &amp;amp;&lt;BR /&gt;Num(Month(Date($(vMinDate)+IterNo()-1)),'00'),&lt;BR /&gt;Year(Date($(vMinDate)+IterNo()-1))*12 + Month(Date($(vMinDate)+IterNo()-1))) AS YearMonth,&lt;BR /&gt;QuarterName(Date($(vMinDate) + IterNo() - 1)) AS Quarter,&lt;BR /&gt;Week(Date($(vMinDate) + IterNo() - 1)) AS Week,&lt;BR /&gt;WeekYear(Date($(vMinDate) + IterNo() - 1)) AS WeekYear&lt;BR /&gt;AUTOGENERATE 1&lt;BR /&gt;WHILE $(vMinDate) + IterNo() - 1 &amp;lt;= $(vMaxDate);&lt;/P&gt;&lt;P&gt;// Two explicit bridges — each matches its key name in Sales_data&lt;BR /&gt;CalendarBridge_Order:&lt;BR /&gt;NOCONCATENATE&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;%CalendarKey AS %CalendarKey_Order,&lt;BR /&gt;LinkDate,&lt;BR /&gt;'Order' AS DateType&lt;BR /&gt;RESIDENT CalendarSource&lt;BR /&gt;WHERE DateType='Order';&lt;/P&gt;&lt;P&gt;CalendarBridge_Invoice:&lt;BR /&gt;NOCONCATENATE&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;%CalendarKey AS %CalendarKey_Invoice,&lt;BR /&gt;LinkDate,&lt;BR /&gt;'Invoice' AS DateType&lt;BR /&gt;RESIDENT CalendarSource&lt;BR /&gt;WHERE DateType='Invoice';&lt;/P&gt;&lt;P&gt;DROP TABLE CalendarSource;&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// Usage notes (inline, non-executing):&lt;BR /&gt;// - Filter with MasterCalendar fields (Year/Month/YearMonth). Toggle Order vs Invoice with DateType from either bridge.&lt;BR /&gt;// - Sales_data now carries amountLC_order (from VBAK/VBKD) and amountLC_invoice side-by-side.&lt;BR /&gt;// - Verify KURSK operator (* vs /) per your SAP rate convention.&lt;BR /&gt;// - Ensure NETWR_invoice exists; if not, adapt the invoice calc to your available fields.&lt;BR /&gt;// ======================================================&lt;/P&gt;</description>
    <pubDate>Thu, 04 Sep 2025 18:45:14 GMT</pubDate>
    <dc:creator>hugo_andrade</dc:creator>
    <dc:date>2025-09-04T18:45:14Z</dc:date>
    <item>
      <title>Combining fields from other QVD + generate master/shared calendar for filtering</title>
      <link>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529327#M107677</link>
      <description>&lt;P&gt;Hello, I have a QVD containing order_number, invoice_number, as well as amount_invoice, amount_order, order_date and invoice_date as well as multiple other fields. The issue is amount_order is incorrect for many orders due to how an order can be priced (long story), so I want to use the order header value from VBAK (I have a VBAK QVD containing all fields), and would need VBELN, WAERK, and then KURSK from VBKD (as currency can be USD, EUR or GBP).&amp;nbsp; I had the below for calculating currency. I want to create a shared/master calendar I can use across all sheets whether they are reporting on order or invoice. My issue there was that invoice or order date would take preference pending load order, where as I want them both equal as to there respective order or invoice.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;TEMP:&lt;BR /&gt;&amp;nbsp;LOAD&lt;BR /&gt;&amp;nbsp;NUM(NUM#(VBELN, '#0')) as order_no,&lt;BR /&gt;&amp;nbsp;BSTDK,&lt;BR /&gt;&amp;nbsp;WAERK,&lt;BR /&gt;&amp;nbsp;Round(Num#(NETWR, '#.#############'), 0.01) as NETWR&lt;BR /&gt;&amp;nbsp;FROM [lib://QVD-Generator/VBAK.qvd] (qvd)&lt;BR /&gt;&amp;nbsp;WHERE&amp;nbsp;fabs(Num#(NETWR, '#.#############')) &amp;gt;= 0.005;&lt;/P&gt;&lt;P&gt;&amp;nbsp;VBKD_Rate:&lt;BR /&gt;&amp;nbsp;LOAD&lt;BR /&gt;&amp;nbsp;NUM(NUM#(VBELN, '#0')) as order_no,&lt;BR /&gt;&amp;nbsp;Max(&lt;BR /&gt;&amp;nbsp;If(&lt;BR /&gt;&amp;nbsp;IsNum(Num#(Replace(KURSK, ',', '.'), '0.0000')),&lt;BR /&gt;&amp;nbsp;Num#(Replace(KURSK, ',', '.'), '0.0000')&lt;BR /&gt;&amp;nbsp;)&lt;BR /&gt;&amp;nbsp;) as KURSK&lt;BR /&gt;&amp;nbsp;FROM [lib://QVD-Generator)/VBKD.qvd] (qvd)&lt;BR /&gt;&amp;nbsp;GROUP BY NUM(NUM#(VBELN, '#0'));&lt;/P&gt;&lt;P&gt;&amp;nbsp;LEFT JOIN (TEMP)&lt;BR /&gt;&amp;nbsp;LOAD order_no, KURSK&lt;BR /&gt;&amp;nbsp;RESIDENT VBKD_Rate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;DROP TABLE VBKD_Rate;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;LOAD&lt;BR /&gt;&amp;nbsp;order_no,&lt;BR /&gt;&amp;nbsp;Sum(&lt;BR /&gt;&amp;nbsp;If(WAERK='GBP', NETWR,&lt;BR /&gt;&amp;nbsp;If(WAERK='EUR', NETWR * KURSK,&lt;BR /&gt;&amp;nbsp;If(WAERK='USD' AND KURSK&amp;lt;&amp;gt;0, NETWR / fabs(KURSK), Null())))&lt;BR /&gt;&amp;nbsp;) as amountLC_order2&lt;BR /&gt;RESIDENT TEMP&lt;BR /&gt;GROUP BY order_no;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My main QVD is just called Sales_data and as mentioned has numerous other fields such as sales_office, order_quantity etc, but I can include those fields as required, my main issue is getting it all to work as one from that Sales_data with the VBAK and VBRK data and the calender and&amp;nbsp;order_date and invoice_date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the long read.&lt;/P&gt;&lt;P&gt;Regards Daryn&lt;/P&gt;&lt;P&gt;Main Sales_data load is;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VKORG,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; num(num#(order_no,'#0')) as order_no,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order_pos,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; material_no,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; material_name,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quantity_order,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; price_per_unit,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unit,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; document_type,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; accounting_type,&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VTWEG,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sales_office,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VKBUR,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; invoice_no,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; invoice_pos,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; invoice_date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quantity_invoice,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WAERK_invoice,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; KURRF_invoice,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Round(&lt;/P&gt;&lt;P&gt;&amp;nbsp; Num(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(WAERK_invoice = 'GBP', NETWR_invoice,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(WAERK_invoice = 'EUR', NETWR_invoice * KURRF_invoice,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(WAERK_invoice = 'USD', NETWR_invoice * (KURRF_invoice))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ))&lt;/P&gt;&lt;P&gt;&amp;nbsp; , '#.#############')&lt;/P&gt;&lt;P&gt;, 0.01) AS amountLC_invoice,&lt;/P&gt;&lt;P&gt;realised UA_Sales missing lots of value due to pricing by PO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quote_no,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quote_pos,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; quantity_quote,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mid(AG_customer,4,11) AS Customer_Number,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mid(AG_customer,16,30) AS Customer_Name,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; intercompany,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; export,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AG_country,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AG_country_name,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WE_country,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EU_zone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; currency,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; customer_order_no,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FROM [lib://QVD-Generator)/ Sales_data.qvd]&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Sep 2025 12:28:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529327#M107677</guid>
      <dc:creator>Daryn</dc:creator>
      <dc:date>2025-09-03T12:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from other QVD + generate master/shared calendar for filtering</title>
      <link>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529400#M107685</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/135319"&gt;@Daryn&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;What you’re describing breaks down into two parts:&lt;/P&gt;&lt;P&gt;Correcting order values by b&lt;SPAN&gt;ringing in the header values from VBAK and the exchange rates from VBKD.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Join those back to your Sales_data so you always have a reliable “local currency order amount” alongside the invoice values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Build a Shared/master calendar.&amp;nbsp;&lt;SPAN&gt;Instead of letting either order_date or invoice_date take precedence, normalize both into one calendar.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;The calendar can carry a &lt;/SPAN&gt;DateType&lt;SPAN&gt; flag (Order vs Invoice) so you can filter across &lt;/SPAN&gt;&lt;EM&gt;all&lt;/EM&gt;&lt;SPAN&gt; dates, or split the analysis by type when needed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Seems a lot, but this way you’ll have&amp;nbsp;&lt;SPAN&gt;Sales_data enriched with corrected amounts from VBAK/VBKD. And a&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;single calendar dimension that works consistently for both order and invoice reporting.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If that direction sounds right to you, I can share a simplified load script example showing how to stitch VBAK/VBKD into Sales_data and then build the calendar bridge.&lt;/P&gt;&lt;P&gt;Let me know!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Sep 2025 21:23:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529400#M107685</guid>
      <dc:creator>hugo_andrade</dc:creator>
      <dc:date>2025-09-03T21:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from other QVD + generate master/shared calendar for filtering</title>
      <link>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529437#M107691</link>
      <description>&lt;P&gt;Hi and many thanks for taking the time to read and reply. That sounds like the perfect way forward, if you don't mind sharing a '&lt;SPAN&gt;simplified load script example' as mentioned, I would really appreciate it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks again.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Daryn&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2025 06:32:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529437#M107691</guid>
      <dc:creator>Daryn</dc:creator>
      <dc:date>2025-09-04T06:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from other QVD + generate master/shared calendar for filtering</title>
      <link>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529574#M107712</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/135319"&gt;@Daryn&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Great, here's the simplified script pattern you can adapt. I'm trying to enrich Sales data with correct order values from VBAK and VBKD; then build a master calendar that covers both order and invoice dates. It's hard to test without the files, but I hope it helps! I ran it on ChatGPT for additional checks. Here it is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// Qlik Script — Enrich Sales_data with VBAK/VBKD + Shared Calendar&lt;BR /&gt;// Final version (single block). Adjust lib paths/field names as needed.&lt;BR /&gt;// ======================================================&lt;/P&gt;&lt;P&gt;// Keep numeric parsing consistent&lt;BR /&gt;SET DecimalSep='.';&lt;BR /&gt;SET MoneyDecimalSep='.';&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// 1) LOOKUPS (MAPPING LOADS) FROM VBAK / VBKD&lt;BR /&gt;// Use ApplyMap() later to avoid big joins and row explosion.&lt;BR /&gt;// ======================================================&lt;/P&gt;&lt;P&gt;// VBAK: header net value (NETWR) per order&lt;BR /&gt;VBAK_Map_NETWR:&lt;BR /&gt;MAPPING&lt;BR /&gt;LOAD&lt;BR /&gt;NUM(NUM#(VBELN,'#0')) AS order_no,&lt;BR /&gt;Round(Num#(NETWR,'#.#############'),0.01) AS NETWR_hdr&lt;BR /&gt;FROM [lib://QVD-Generator/VBAK.qvd] (qvd)&lt;BR /&gt;WHERE fabs(Num#(NETWR,'#.#############')) &amp;gt;= 0.005;&lt;/P&gt;&lt;P&gt;// VBAK: header currency (WAERK) per order&lt;BR /&gt;VBAK_Map_WAERK:&lt;BR /&gt;MAPPING&lt;BR /&gt;LOAD&lt;BR /&gt;NUM(NUM#(VBELN,'#0')) AS order_no,&lt;BR /&gt;WAERK AS WAERK_hdr&lt;BR /&gt;FROM [lib://QVD-Generator/VBAK.qvd] (qvd);&lt;/P&gt;&lt;P&gt;// VBKD: normalize KURSK and aggregate one rate per order&lt;BR /&gt;VBKD_Pre:&lt;BR /&gt;LOAD&lt;BR /&gt;NUM(NUM#(VBELN,'#0')) AS order_no,&lt;BR /&gt;Num#(Replace(KURSK,',','.'),'0.0000') AS KURSK_norm&lt;BR /&gt;FROM [lib://QVD-Generator/VBKD.qvd] (qvd);&lt;/P&gt;&lt;P&gt;VBKD_KURSK_Map:&lt;BR /&gt;MAPPING&lt;BR /&gt;LOAD&lt;BR /&gt;order_no,&lt;BR /&gt;Max(KURSK_norm) AS KURSK_order&lt;BR /&gt;RESIDENT VBKD_Pre&lt;BR /&gt;GROUP BY order_no;&lt;/P&gt;&lt;P&gt;DROP TABLE VBKD_Pre;&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// 2) FACT LOAD: SALES_DATA ➜ ENRICH &amp;amp; SAFE CALCS&lt;BR /&gt;// No self-joins. Compute with ApplyMap() in a derived RESIDENT load.&lt;BR /&gt;// ======================================================&lt;/P&gt;&lt;P&gt;Sales_data:&lt;BR /&gt;LOAD&lt;BR /&gt;VKORG,&lt;BR /&gt;NUM(NUM#(order_no,'#0')) AS order_no,&lt;BR /&gt;order_pos,&lt;BR /&gt;material_no,&lt;BR /&gt;material_name,&lt;BR /&gt;quantity_order,&lt;BR /&gt;price_per_unit,&lt;BR /&gt;unit,&lt;BR /&gt;document_type,&lt;BR /&gt;accounting_type,&lt;BR /&gt;VTWEG,&lt;BR /&gt;Date(order_date) AS order_date,&lt;BR /&gt;sales_office,&lt;BR /&gt;VKBUR,&lt;/P&gt;&lt;P&gt;NUM(NUM#(invoice_no,'#0')) AS invoice_no,&lt;BR /&gt;invoice_pos,&lt;BR /&gt;Date(invoice_date) AS invoice_date,&lt;BR /&gt;quantity_invoice,&lt;BR /&gt;WAERK_invoice,&lt;BR /&gt;KURRF_invoice,&lt;BR /&gt;// Include if exists in QVD; otherwise amountLC_invoice will be null (safe):&lt;BR /&gt;NETWR_invoice,&lt;/P&gt;&lt;P&gt;// Other descriptive fields&lt;BR /&gt;quote_no,&lt;BR /&gt;quote_pos,&lt;BR /&gt;quantity_quote,&lt;BR /&gt;Mid(AG_customer,4,11) AS Customer_Number,&lt;BR /&gt;Mid(AG_customer,16,30) AS Customer_Name,&lt;BR /&gt;intercompany,&lt;BR /&gt;export,&lt;BR /&gt;AG_country,&lt;BR /&gt;AG_country_name,&lt;BR /&gt;WE_country,&lt;BR /&gt;EU_zone,&lt;BR /&gt;currency,&lt;BR /&gt;customer_order_no&lt;BR /&gt;FROM [lib://QVD-Generator/Sales_data.qvd] (qvd);&lt;/P&gt;&lt;P&gt;// Derive enriched fields (no joins)&lt;BR /&gt;Sales_data_fixed:&lt;BR /&gt;NOCONCATENATE&lt;BR /&gt;LOAD&lt;BR /&gt;*,&lt;BR /&gt;// Lookups via ApplyMap (header net/currency/rate per order)&lt;BR /&gt;ApplyMap('VBAK_Map_NETWR', order_no, Null()) AS NETWR_hdr,&lt;BR /&gt;ApplyMap('VBAK_Map_WAERK', order_no, Null()) AS WAERK_hdr,&lt;BR /&gt;ApplyMap('VBKD_KURSK_Map', order_no, 0) AS KURSK_order,&lt;/P&gt;&lt;P&gt;// Corrected ORDER amount in local currency&lt;BR /&gt;// ⚠ Verify KURSK direction in your SAP extract and flip * vs / if needed.&lt;BR /&gt;Round(&lt;BR /&gt;Num(&lt;BR /&gt;If(WAERK_hdr='GBP', NETWR_hdr,&lt;BR /&gt;If(WAERK_hdr='EUR', NETWR_hdr * KURSK_order,&lt;BR /&gt;If(WAERK_hdr='USD' and KURSK_order&amp;lt;&amp;gt;0, NETWR_hdr / fabs(KURSK_order),&lt;BR /&gt;Null())))&lt;BR /&gt;,'#.#############')&lt;BR /&gt;,0.01) AS amountLC_order,&lt;/P&gt;&lt;P&gt;// INVOICE amount in local currency (guard for missing inputs)&lt;BR /&gt;Round(&lt;BR /&gt;Num(&lt;BR /&gt;If(WAERK_invoice='GBP' and IsNum(NETWR_invoice), NETWR_invoice,&lt;BR /&gt;If(WAERK_invoice='EUR' and IsNum(NETWR_invoice) and IsNum(KURRF_invoice), NETWR_invoice * KURRF_invoice,&lt;BR /&gt;If(WAERK_invoice='USD' and IsNum(NETWR_invoice) and IsNum(KURRF_invoice) and KURRF_invoice&amp;lt;&amp;gt;0, NETWR_invoice * KURRF_invoice,&lt;BR /&gt;Null())))&lt;BR /&gt;,'#.#############')&lt;BR /&gt;,0.01) AS amountLC_invoice,&lt;/P&gt;&lt;P&gt;// Calendar keys (one per business date type)&lt;BR /&gt;Hash128(NUM(order_no), 'Order') AS %CalendarKey_Order,&lt;BR /&gt;Hash128(NUM(invoice_no), 'Invoice') AS %CalendarKey_Invoice&lt;/P&gt;&lt;P&gt;RESIDENT Sales_data;&lt;/P&gt;&lt;P&gt;DROP TABLE Sales_data;&lt;BR /&gt;RENAME TABLE Sales_data_fixed TO Sales_data;&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// 3) SHARED / MASTER CALENDAR (supports Order + Invoice without precedence)&lt;BR /&gt;// Use two explicit bridge tables so field names match and associations work.&lt;BR /&gt;// ======================================================&lt;/P&gt;&lt;P&gt;// Normalize both business dates into a single staging source&lt;BR /&gt;CalendarSource:&lt;BR /&gt;LOAD&lt;BR /&gt;%CalendarKey_Order AS %CalendarKey,&lt;BR /&gt;Date(order_date) AS LinkDate,&lt;BR /&gt;'Order' AS DateType&lt;BR /&gt;RESIDENT Sales_data&lt;BR /&gt;WHERE not IsNull(order_date);&lt;/P&gt;&lt;P&gt;CONCATENATE (CalendarSource)&lt;BR /&gt;LOAD&lt;BR /&gt;%CalendarKey_Invoice AS %CalendarKey,&lt;BR /&gt;Date(invoice_date) AS LinkDate,&lt;BR /&gt;'Invoice' AS DateType&lt;BR /&gt;RESIDENT Sales_data&lt;BR /&gt;WHERE not IsNull(invoice_date);&lt;/P&gt;&lt;P&gt;// Build continuous date island (MasterCalendar) from min/max&lt;BR /&gt;TempMinMax:&lt;BR /&gt;LOAD&lt;BR /&gt;Min(LinkDate) AS MinDate,&lt;BR /&gt;Max(LinkDate) AS MaxDate&lt;BR /&gt;RESIDENT CalendarSource;&lt;/P&gt;&lt;P&gt;LET vMinDate = Num(Peek('MinDate',0,'TempMinMax'));&lt;BR /&gt;LET vMaxDate = Num(Peek('MaxDate',0,'TempMinMax'));&lt;BR /&gt;DROP TABLE TempMinMax;&lt;/P&gt;&lt;P&gt;MasterCalendar:&lt;BR /&gt;LOAD&lt;BR /&gt;Date($(vMinDate) + IterNo() - 1) AS LinkDate,&lt;BR /&gt;Year(Date($(vMinDate) + IterNo() - 1)) AS Year,&lt;BR /&gt;Month(Date($(vMinDate) + IterNo() - 1)) AS Month,&lt;BR /&gt;Dual(Year(Date($(vMinDate)+IterNo()-1)) &amp;amp; '-' &amp;amp;&lt;BR /&gt;Num(Month(Date($(vMinDate)+IterNo()-1)),'00'),&lt;BR /&gt;Year(Date($(vMinDate)+IterNo()-1))*12 + Month(Date($(vMinDate)+IterNo()-1))) AS YearMonth,&lt;BR /&gt;QuarterName(Date($(vMinDate) + IterNo() - 1)) AS Quarter,&lt;BR /&gt;Week(Date($(vMinDate) + IterNo() - 1)) AS Week,&lt;BR /&gt;WeekYear(Date($(vMinDate) + IterNo() - 1)) AS WeekYear&lt;BR /&gt;AUTOGENERATE 1&lt;BR /&gt;WHILE $(vMinDate) + IterNo() - 1 &amp;lt;= $(vMaxDate);&lt;/P&gt;&lt;P&gt;// Two explicit bridges — each matches its key name in Sales_data&lt;BR /&gt;CalendarBridge_Order:&lt;BR /&gt;NOCONCATENATE&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;%CalendarKey AS %CalendarKey_Order,&lt;BR /&gt;LinkDate,&lt;BR /&gt;'Order' AS DateType&lt;BR /&gt;RESIDENT CalendarSource&lt;BR /&gt;WHERE DateType='Order';&lt;/P&gt;&lt;P&gt;CalendarBridge_Invoice:&lt;BR /&gt;NOCONCATENATE&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;%CalendarKey AS %CalendarKey_Invoice,&lt;BR /&gt;LinkDate,&lt;BR /&gt;'Invoice' AS DateType&lt;BR /&gt;RESIDENT CalendarSource&lt;BR /&gt;WHERE DateType='Invoice';&lt;/P&gt;&lt;P&gt;DROP TABLE CalendarSource;&lt;/P&gt;&lt;P&gt;// ======================================================&lt;BR /&gt;// Usage notes (inline, non-executing):&lt;BR /&gt;// - Filter with MasterCalendar fields (Year/Month/YearMonth). Toggle Order vs Invoice with DateType from either bridge.&lt;BR /&gt;// - Sales_data now carries amountLC_order (from VBAK/VBKD) and amountLC_invoice side-by-side.&lt;BR /&gt;// - Verify KURSK operator (* vs /) per your SAP rate convention.&lt;BR /&gt;// - Ensure NETWR_invoice exists; if not, adapt the invoice calc to your available fields.&lt;BR /&gt;// ======================================================&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2025 18:45:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529574#M107712</guid>
      <dc:creator>hugo_andrade</dc:creator>
      <dc:date>2025-09-04T18:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Combining fields from other QVD + generate master/shared calendar for filtering</title>
      <link>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529684#M107721</link>
      <description>&lt;P&gt;Hi Hugo, so many thanks again for your help. I applied that but get hit with&lt;/P&gt;&lt;P&gt;'The following error occurred: Field 'WAERK_hdr' not found'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;at the point of adding=&lt;/P&gt;&lt;P&gt;// Calendar keys (one per business date type)&lt;BR /&gt;Hash128(NUM(order_no), 'Order') AS %CalendarKey_Order,&lt;BR /&gt;Hash128(NUM(invoice_no), 'Invoice') AS %CalendarKey_Invoice&lt;/P&gt;&lt;P&gt;RESIDENT Sales_data;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if I comment that part and the rest of the script out it loads okay up until there (if that makes sense).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rightly or wrongly, I corrected that by loading a temp table just for the maps to exist first, as:&lt;/P&gt;&lt;P&gt;// Derive enriched fields (no joins)&lt;BR /&gt;Sales_data_temp:&lt;BR /&gt;NOCONCATENATE&lt;BR /&gt;LOAD&lt;BR /&gt;*,&lt;BR /&gt;// Lookups via ApplyMap (header net/currency/rate per order)&lt;BR /&gt;ApplyMap('VBAK_Map_NETWR', order_no, Null()) AS NETWR_hdr,&lt;BR /&gt;ApplyMap('VBAK_Map_WAERK', order_no, Null()) AS WAERK_hdr,&lt;BR /&gt;ApplyMap('VBKD_KURSK_Map', order_no, 0) AS KURSK_order&lt;BR /&gt;Resident Sales_data;&lt;/P&gt;&lt;P&gt;Sales_data_fixed:&lt;BR /&gt;NOCONCATENATE&lt;BR /&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though that now loads my results are okay until I include the values.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daryn_0-1757068053109.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/183459iF3A87D3683FEDDF3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daryn_0-1757068053109.png" alt="Daryn_0-1757068053109.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As soon as I add amountLC_order or amountLC_invoice to either of the tables, it errors (calculation too large), even if I filter using the mastercalendar Year/Month/Week to one specific week. Actually as soon as I add any other fields it does the same. Sorry! Hoping the attachments might help you. Again appreciate your time and expertise.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2025 11:23:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combining-fields-from-other-QVD-generate-master-shared-calendar/m-p/2529684#M107721</guid>
      <dc:creator>Daryn</dc:creator>
      <dc:date>2025-09-05T11:23:19Z</dc:date>
    </item>
  </channel>
</rss>

