Is it possible to write a "matchmaking" query in Access 2007? - database

I am trying to create a database that will essentially act as a matchmaking service. I have two tables with the same categories, Clients and Opportunities.
The idea is to enter buy-side Clients as we acquire them, filling out the applicable descriptive fields (EBITDA, Gross Revenue, etc).
Then, when a possible Opportunity comes along, I enter that info in its respective table (with EBITDA, Gross Revenue, etc).
The idea is then to run a query that will essentially "match" records from Clients with records from Opportunities, in a prioritized order, i.e. the items with most matching fields rank at the top.
So I've created the tables (Clients and Opportunities), a third table Values that contains the possible choices for several of the fields, and forms for entering the information into Opportunities and Clients.
I've entered a test record in both Opportunities and Clients tables with several matching fields. But my query isn't returning any hits. Per some advice I received, I tried to add in some SQL code to address a possible NULL issue, but Access won't accept the code. Can this query be written? Are the results I'm looking for possible?
My query, designed using the Wizard, looks like this and returns no hits, despite the sample records in each table having matching entries:
SELECT Clients.*, Opportunities.*
FROM Clients INNER JOIN Opportunities
ON (Clients.[NAICS Sector Codes]=Opportunities.[NAICS Sector Codes])
AND (Clients.[Business Model]=Opportunities.[Business Model])
AND (Clients.[Gross Revenue]=Opportunities.[Gross Revenue])
AND (Clients.EBITDA=Opportunities.EBITDA)
AND (Clients.[EBITDA Margin (%)]=Opportunities.[EBITDA Margin (%)])
AND (Clients.[Growth-Timeframe in Years]=Opportunities.[Growth-Timeframe in Years])
AND (Clients.[Growth-Revenue]=Opportunities.[Growth-Revenue])
AND (Clients.[Growth-EBITDA (%)]=Opportunities.[Growth-EBITDA (%)])
AND (Clients.[Geographical Operational Location Preference]=Opportunities.[Geographical Operational Location Preference])
AND (Clients.[Debt Load]=Opportunities.[Debt Load])
AND (Clients.[Primary Area of Sales Concentration (Geographic)]=Opportunities.[Primary Area of Sales Concentration (Geographic)])
AND (Clients.[% of total revenue from ≤ top 3 customers]=Opportunities.[% of total revenue from ≤ top 3 customers])
AND (Clients.[% of total revenue from ≤ top 10 customers]=Opportunities.[% of total revenue from ≤ top 10 customers])
AND (Clients.[% of total revenue from ≤ top 20 customers]=Opportunities.[% of total revenue from ≤ top 20 customers])
AND (Clients.[Current Management Post-Transaction Plan]=Opportunities.[Current Management Post-Transaction Plan])
AND (Clients.[Preferred Deal Structure]=Opportunities.[Preferred Deal Structure]) AND (Clients.NAPCS=Opportunities.NAPCS)
AND (Clients.Notes=Opportunities.Notes)
AND (Clients.[ZLD Sector Notes]=Opportunities.[ZLD Sector Notes]);

Related

Calculating dynamic pricing on Google Sheets

I have imported data from a trading exchange listing sellers of a particular cryptocurrency.
From this data, I want to create dynamic pricing to display an average cost on an order based on given order size.
I will give an example of what I am looking for:
Example dataset
Within this example, we would be purchasing the cryptocurrency 'SINS'. As per the data showed on this table, if 29.06 SINS was purchased, that would fill the first order, and the total BTC paid would be 0.00459 BTC.
If an order was placed for 145 SINS, it would fill the orders up to row 12 and partially fill the order in row 13. By calculating that manually, I know that would cost 0.02293365 BTC (calculated using col D) at an average price of 0.00015816 per SIN.
What I would like to achieve is if a number is entered in a cell, it confirms the average price of an order based on the number entered and the orders imported from the trading exchange.
=INDIRECT(ADDRESS(MATCH(VLOOKUP(O2,F2:F,1),F:F,0),7,4))+(
INDIRECT(ADDRESS(MATCH(VLOOKUP(O2,F2:F,1),F:F,0)+1,4,4))*(O2-
INDIRECT(ADDRESS(MATCH(VLOOKUP(O2,F2:F,1),F:F,0),6,4)))/
INDIRECT(ADDRESS(MATCH(VLOOKUP(O2,F2:F,1),F:F,0)+1,3,4)))
spreadsheet demo

Find Whole Duplicated Invoices in SQL

I'm trying to write some SQL to allow me to get result of possible duplicated Invoices that will have the same [same Items, with Same Quantity], That is possible to be Duplicate issued
Invoice items Average around 300 Item
Total Invoice To be Revision around 2500 Invoice
The Following is a invoices sample with only 1 items or so, but in real population items average is 300
Inv_ID Item_Code Item_Q
A-800 101010 24
A-801 101010 24
A-802 202020 9
A-803 101010 18
A-804 202020 9
A-805 202020 9
A-806 101010 18
Hoping The Excepted Result will be
A-800, A-801
A-802, A-804, A-805
A-803, A-806
But the invoice has around 200 item, and the duplicated invoices has to be has the same items and exact same quantity for these.
It's SQL_Server
And The Result need to match the whole Invoices item
Like Invoice A has 300 Different Items line with each one Quantity 2
The Results need to be all invoice has the exact same 300 Item with the Exact Quantity.
The Supplier has issued multiple duplicated invoice to our accounting
Department by mistakes over 4 years, it was discovered by chance, so
we need to find out the duplicated invoice to remove it from payment
schedule.
The issued invoices Need to has the exact different items with exact quantity to be considered duplicated.,,,
You didn't specify your DBMS product, so this answer is for Postgres.
select string_agg(inv_id, ',' order by inv_id) as inv_ids
from the_table
group by item_code, item_q
order by inv_ids;
Online example
Other DBMS products have similar functions to do the aggregation. In Oracle or SQL Server, you would use listagg(), in MySQL you would use group_concat(). The individual syntax would be slightly different (you have to check the manual), but the idea is the same.

SQL syntax to calculate total menu items per meal orderID across multiple meal orderIDs

I am new to SQL and Stack overflow and have a question about SQL Server syntax. i have searched online but I am not finding what I need and I would appreciate your assistance in this matter.
I have data in a source table for meal orders (each with a specific ID (e.g. 12345C) and items of each order (e.g. sandwich, drink, chips), each with an associated number starting with 1. For instance, the sandwich would have an item number of 1, the chips would be item # 2, and the drink would be item # 3 for the same orderID 12345C. The prior example would therefore have 3 rows of data in the source table for orderID 12345C.
My questions are these:
how do I use a SQL expression to determine the number of items per each order (e.g. 3 for the above example, which is also the maximum value for item number for each orderID)
and then add all of these items per order across hundreds of orders per day to determine the daily total number of items ordered.
So, if I had 3 orders in one day - one with 2 items, the second with 3 items, and the third with 4 items, I would like my final number to be 9.
This number is for use in a Sisense dashboard that allows SQL syntax in the field definition. Thank you for your help!
It is a bit difficult to explain but I am not able to use a query from a table because I am working with a dashboard in Sisense so I am adding fields in a pivot display and one of the fields I would like to include is the total count of order items per day (across several dozen orderIDs).
Here is an example of the data in the table: from the example I would like the final answer for orderID 1787588 to be 3 (there are 3 items within the order).

Calculating % of Grand Total in Pivot Tables

I have a pivot table in Excel.
My dataset includes workforce numbers for the 32 states in the country, which are grouped in six different regions. This data set is divided into quarters since 2015 to date.
I need this table to show both the % of total workforce at a national level, and at a regional level.
I have tried using calculate, sum, allselected, but then if I use an slicer and show just one region, I end up with the % of workforce within that region and not at a national level.
I am a beginner in DAX and using Power Pivot, how can I calculate the total workforce at a national level for a given period so that it doesn't change if I change the region?
Please help!
Let's say you have a measure called "Total Workforce" (whatever it is - you haven't provided any information about its meaning).
To calculate total workforce at a national level, you need to create another measure:
National Workforce = CALCULATE( [Total Workforce], ALL(Table[Region]))
where Table is your table name, and Region is the name of the field containing regions. Function ALL in DAX removes all filters from a column, a list of columns, or an entire table.
Then, to calculate the ratio:
Workforce % of National = DIVIDE( [Total Workforce], [National Workforce])
Please note: it's very hard to answer questions like that without seeing your data, data model, formulas and the description of the desired outcome. It'd be great if you could provide this information.

How to show subtotal and total of groups in ssrs

I am making an SSRS report in following format:
DIVISION
SECTOR
DEPARTMENT
Division contain Sector and Sector contain Department so resulting report becomes something like following. A figure is being shown against each Department and I want to show SUBTOTAL of each Sector right against Sector column (by adding all Department coming under it) and then show TOTAL of Division (by adding all Department or all Sector) at the end. How do I show these totals?
Division1
Sector1 SUBTOTAL HERE (for e.g. 19,000)
Department1 10,000
Department2 9,000
Sector2 SUBTOTAL HERE (for e.g. 8,000)
Department3 8,000
Sector3 SUBTOTAL HERE (for e.g. 13,000)
Department4 10,000
Department5 1,000
Department6 2,000
TOTAL HERE (for e.g. 40,000)
Division2
Sector4 SUBTOTAL HERE (for e.g. 3,500)
Department7 3,500
TOTAL HERE (for e.g. 3,500)
My report is displaying all divisions, sectors and departments with figures like above (I am using groups ) but how do I display SUBTOTAL and TOTAL?
for this report I will assume you have three groups in your Row Groups Pane (Row groups will be there either you use a Matrix or Tablix).
DIVISION (DIVISION Group)
SECTOR (SECTION Group)
DEPARTMENT (Details Group)
Adding totals and sub totals are probably the simplest task in SSRS. See below goto your Row groups pane and add Totals to all the groups you want to, Which will appear as Totals and Sub Totals in your report.

Resources