0

Filter where Table A is NOT Equal to Table B

Hello,

As NAV kicks Sales Orders out of the Sales Header table into the Sales Header Archive table once the Order is complete which may occur within given time period, I need to search both tables to find unique No.s that fall within the time period. So I can get down to two metrics:
1) a Count of Orders generated during a time period
2) the Sum of Orders over that same time period.

So I'm trying to find & report on current Sales Headers No.s as well as No.s which exist only in the Sales Header Archive table (i.e., are no longer in the Sales Header table). While I know I can use Link= or NL("Filter",…) to restrict the Sales Header Archive table to only values which also appear in the Sales Header table, what I need is a way to filter for values NOT in the Sales Header table. (Where results from table A are not found in table B).

Here are a few variations of what I've tried so far:

Using "<>" rather than "=" when in a Link= function (didn't work):
=NL("Rows","Sales Header Archive","No.","Link=","Sales Header","No.","<>No.")..using <> and = together on that last bit didn;t work either: "(""=""&""=No."")"
Using "<>" with the NL("filter",..) returned 'Invalid Filter' errors:
=NL("Rows","Sales Header Archive","No.","No.","<>NL(""Filter"",""Sales Header"",""No."")")After some trial & error I came across imbedding the NP("Difference",…) function within NL("Rows",…):
=NL("Rows",np("Difference",NL("AllUnique","Sales Header Archive","No.","Document Type","Order"),NL("AllUnique","Sales Header","No.","Document Type","Order")))
This last one works great for producing a list of No.s unique to the Sales Header Archive; when paired with the Sales Header table I can get a listing of all unique Sales document No.s. However, re-producing the entire Sale Header and (unique No.s) Sales Header Archive tables and then using Sumifs() to have Excel scoure those records for Dates withing range takes painfuly long time.

I'd like to take Excel out of the equation and rely on properly placed Jet filters to pull only the applicable date using NL("Sum",..) and NL("Countunique",…). So I tweak the above formula filtering on the field "Order Date" (cells I2 & I3 contain dates):
=NL("countunique",np("Difference",NL("AllUnique","Sales Header Archive","No.","Order Date",NP("Datefilter",I2,I3)),NL("AllUnique","Sales Header","No.","Filters=","Order Date",NP("Datefilter",I2,I3))))However, the figures returned are either 0 or equal to a count of All unique No.s in both tables without consideration of the datefilter. I've tried filtering on other date fields as well as adding a filter to ony check for the last archived Version No. but I have not been able to get this to work.

Am I going about this totaly wrong: is there a way to get "<>" to work with either Link= or NL("Filter",…)?
Has anyone linked the Sales Header & Sales Header Archive (or Purchasing, or Lines) tables before in an attempt to root out unique values is an easier way?

Thanks in advance,

-Dave-

2 comments

Please sign in to leave a comment.