Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ajithsachin
Partner - Contributor II
Partner - Contributor II

Last Sale Date As Per The Credit Note Date

Hi All,

I have two tables, ie; Sales and credit note data. I need to make a report that should show credit note details of the item batch with when it sold last time.(Last sold date should be less than credit note date)

Below i am attaching my sample table structure with data.

Sales:-

InvNumDateItemBatchQtyValue
101-04-2016item1batch110100
210-04-2016item1batch110100
313-04-2016item1batch1550

Credit Note:-

CreditNoteNum
DateItemBatchQtyValue
103-04-2016item1batch1880
212-04-2016item1batch1550
315-04-2016item1batch1550

and my expected result table is something like this below.

   

ItemBatchCreditNote DateLast SaleDate
item1batch103-04-201601-04-2016
item1batch112-04-201610-04-2016
item1batch115-04-201613-04-2016

Can anybody help please..

Regards,

Ajith

5 Replies
swuehl
MVP
MVP

You can create a date interval from your CreditNote dates:

Creating a Date Interval from a Single Date

Then use INTERVALMATCH LOAD prefix to link your credit notes to the sales dates, using Item and batch as keys:

IntervalMatch

sunny_talwar

Does Qty and Value also take a part in knowing how the two tables need to join together?

ajithsachin
Partner - Contributor II
Partner - Contributor II
Author

It is actually inside the FACT table. Qty we can change to Sales_Qty and Return_Qty and value will be Sales_Value and Return_Value.

So that Fact will look like this

FACT.png

sunny_talwar

So currently it looks like this? but you want them to be on the same line? Is that the goal?

ajithsachin
Partner - Contributor II
Partner - Contributor II
Author

i want to show a report like same item same batch on which date credit note happened and in next column when was that batch sold last time.(max of sales date where sale date less than equal to credit note date)

May be something like this below.

Result.png