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
-
Jet Reports Historic Posts =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.
Upon further investigation that formula was returning the total unique No. from the Sales Header table when there were no Sales Header Archive No.s which with a particular Order Date. Adding a conditonal statement solved that problem:=IF(NL("AllUnique","Sales Header Archive","No.","Order Date",NP("Datefilter",I2,I3))=0,0,NL("countunique",np("Difference",NL("AllUnique","Sales Header Archive","No."),NL("AllUnique","Sales Header","No.","Filters=","Order Date",NP("Datefilter",I2,I3))))
While it may be a bit long, the above formula returns a count of unqiue No.s from the Sales Header Archive table which do not appear on the Sales Header table. I also removed the Order Date filter from the Sales Header section as I want to remove any No. that appears in the Sales Header table, no just those with the same Order Date as well.
Now that I fixed the equation my original question still stands: is there an easier way?
Thanks,
-Dave- -
Jet Reports Historic Posts Hi Dave,
The behavior you're experiencing is actually an oddity with the older NL(AllUnique) function. If you use the newer NL(Filter) functions instead, I believe you should get the result you want without the Excel IF function. So it would look something like this:=NL("count",np("Difference",NL("Filter","Sales Header Archive","No.","Order Date",NP("Datefilter",I2,I3)),NL("Filter","Sales Header","No.","Order Date",NP("Datefilter",I2,I3))))
I don't believe it is necessary to use NL(CountUnique) since the NL(Filter) will always return a unique list of values. Also, the "Filters=" you had was unnecessary since you are not specifying an array of filters. Does this work for you?
Regards,
Hughes