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: 
bhaskarsharma03
Creator
Creator

Find the missing entries

Hi,

I have a data of plants, and invoices related to those plants. The invoice numbers are alphanumeric, always ending with a number. The invoices are meant to be created by an increment of 1 (at the numeric part of the string) for each new invoice created. However, it is noted that a lot of invoice numbers are missing. In the example below, you can see the missing invoices:

InvoiceNumberPlantCodeComment
NS05060100001419NS05
NS05060100001420NS05
NS05060100001421NS05
NS05060100001423NS05Invoice number ending with 22 is missing
NS05060100001424NS05
NS05060100001428NS05Invoice numbers ending with 25, 26, 27 are missing
NS05060100001431NS05Invoice numbers ending with 29, 30 are missing
NS05060100001435NS05Invoice numbers ending with 32, 33, 34  are missing

I need to find out all the missing InvoiceNumber by PlantCode. So, for the example above, the outcome I am looking for is:

MissingInvoicesPlantCode
NS05060100001422NS05
NS05060100001425NS05
NS05060100001426NS05
NS05060100001427NS05
NS05060100001429NS05
NS05060100001430NS05
NS05060100001432NS05
NS05060100001433NS05
NS05060100001434NS05

Could anyone please help how do I go about identifying the missing invoices by each plant?

Regards,

Bhaskar

1 Reply
sunny_talwar

Something along these lines

INV_TABLE:

LOAD InvoiceNumber,

     PlantCode,

     [Pstng Date],

     Right(InvoiceNumber, 12) as InvNum

FROM

[missing invoice.xls]

(biff, embedded labels, table is Sheet1$);


Concatenate(INV_TABLE)

LOAD PlantCode,

PlantCode & Num(Temp, '000000000000') as InvoiceNumber

Where not Exists(InvoiceNumber, PlantCode & Num(Temp, '000000000000'));

LOAD PlantCode,

Min + IterNo() - 1 as Temp

While Min + IterNo() - 1 <= Max;

LOAD PlantCode,

Min(InvNum) as Min,

Max(InvNum) as Max

Resident INV_TABLE

Group By PlantCode;