I have the following data (examples):
tblModel
Mod_ID Mod_Num Mod_Desc
1 0001 Model01
2 0002 Model02
tblArticle
Art_ID Art_Num Art_Desc
1 001 Article X
2 002 Article Y
3 003 Article Z
4 004 Article K
tblOperation
Op_ID Op_Num Op_Desc
1 01 Gluing
2 02 Sewing
3 03 Stitching
tblMaterial
Mat_ID Mat_Num Mat_Desc
1 B001 Blue
2 R001 Red
3 K001 Black
And the data structure is as follows:
tblModelArticle
MA_ID Mod_ID Art_ID MA_Description
1 1 1 Model01 - Article X
2 1 2 Model01 - Article Y
3 2 3 Model02 - Article Z
4 2 4 Model02 - Article K
tblModelOperation
MO_ID Mod_ID Op_ID MO_Description
1 1 1 Model01 - Op Gluing
2 1 2 Model01 - Op Sewing
3 1 3 Model01 - Op Stitching
4 2 1 Model02 - Op Gluing
5 2 3 Model02 - Op Stitching
tblArticleOperationMaterial
AOM_ID MA_ID MO_ID Mat_ID AOM_Description
1 1 3 1 Model01 - Article X - Operation Stitching - Material Blue
2 2 3 2 Model01 - Article Y - Operation Stitching - Material Red
3 3 5 2 Model02 - Article Z - Operation Stitching - Material Red
4 4 5 3 Model02 - Article K - Operation Stitching - Material Black
My question is: How do I make a ComboBox dropdown in tblArticleOperationMaterial limited? That is, once I for example select "MA_ID" to be 1, I want to be able to select only the 1, 2, 3 as MO_ID. For instance if "MA_ID" 2 value was input, the MO_ID dropbox combox box would offer only options of 4 and 5 to be selected as MO_ID.
its called cascading action. search for cascading combobox or
check this :MS Access Forms : How to dynamically change the select options in a combo box?
or similar question:
Get ID Filed from a Combobox in a Text Box where 1st column set to 0
Related
Here is the table:
itemcode
batch
subbatch
desc
itemcode
batch
subbatch
desc
A
1
1
red
B
1
1
red
C
9
1
red
C
9
2
blue
D
8
1
red
D
8
2
blue
E
2
1
red
F
3
1
red
G
4
1
red
H
1
1
red
I
9
1
red
I
9
2
blue
J
8
1
red
J
8
2
blue
There are two kinds of items, one item with just 1 batch and 1 subbatch, the other item has 1 batch and multiple subbatch.
I want to select all items with the 1 batch / 1 subbatch including the other items with 1 batch and a specific subbatch. In this case, items with batch 8 or 9 has multiple subbatch. I wanted to select all items that is not in batch 8 or 9 plus items with batch 8 or 9 with subbatch 2.
From what you describe you can use not exists with boolean logic:
select t.*
from t
where not exists (select 1
from t t2
where t2.itemcode = t.itemcode and
t2.subbatch <> t.subbatch
) or
subbatch = 2;
I need a dax measure which shows me which customers bought products B and C in last 90 days.
And another one which shows me those whose bought products B and C in last 90 days.
(based in my filter date context)
Below is like it should be:
Can someone help me?
Here is a sample data if needed:
FactSales
KeyDate KeyCustomer KeyProduct Total
1 1 1 12,9
1 2 2 13
1 3 1 156,4
1 4 1 564,8
2 1 1 894,8
2 2 1 56,5
3 1 2 564,85
3 2 3 564,8
4 1 1 1325,6
4 2 1 132,3
Customer
KeyCustomer Name
1 Jean
2 Mari
3 Lisa
4 Julian
5 Jhonny
Calendar
KeyDate Date
1 01/01/2018
2 02/01/2018
3 01/05/2018
4 01/08/2018
Product
KeyProduct Product
1 A
2 B
3 C
Try something along these lines:
IfBought = IF(
COUNTROWS(
FILTER(FactSales,
RELATED('Product'[Product]) IN {"B", "C"} &&
RELATED('Calendar'[Date]) > TODAY() - 90)
) > 0,
1, 0)
Note that May 1st is longer than 90 days ago as of today though, so you won't get the result you asked for unless you change 90 to 114 or greater.
Here is the info i have on my tables, what i need is to create a report based on certain dates and make a sum of every stock movement of the same id
Table one Table Two
Items Stocks
---------- ---------------------------
ID - NAME items_id - altas - bajas - created_at
1 White 4 5 0 8/10/2016
2 Black 2 1 5 8/10/2016
3 Red 3 3 2 8/11/2016
4 Blue 4 1 4 8/11/2016
2 10 2 8/12/2016
So based on a customer choice of dates (on this case lets say it selects all the data available on the table), i need to group them by items_id and then SUM all altas, and all bajas for that items_id, having the following at the end:
items_id altas bajas
1 0 0
2 11 7
3 3 2
4 6 4
Any help solving this?
Hope this will help:
Stock.select("sum(altas) as altas, sum(bajas) as bajas").group("item_id")
I have a track and Field Database with these tables (simplified):
Performance Table
Row Athlete Event Mark Meet
1 1 3 0:55 A
2 2 2 2:25 A
3 3 3 0:54 A
4 4 4 4:10 A
5 2 2 2:11 A
6 3 2 2:12 B
7 1 1 10 C
Athlete Table
Row Name Age Sex
1 Joe 13 M
2 Amy 15 F
3 John 16 M
4 Tim 17 M
So I understand how to implement this for an event with only 1 athlete (e.g. 100 m dash), but how would I include a relay event with 4 athletes. So, for example a 4x400 relay would need 4 athletes. In other words, some events have only 1 athlete and some have more than one. I am not sure if I should use:
Linking Table
Add 4 Columns
Do a table like below.
Other
Option 3 Table
Performance Table (Event 5 is a relay)
Row Athlete Event Mark Meet
1 1 3 0:55 A
2 2 2 2:25 A
3 3 3 0:54 A
4 4 4 4:10 A
5 2 2 2:11 A
6 3 2 2:12 B
7 1 5 9:34 C
8 2 5 9:34 C
9 3 5 9:34 C
10 4 5 9:34 C
Are you going to have events in the system before they are finished? For example, today's meet will include a 4x400 and here are the runners...
If that's the case then you'll need the linking table that you referred to because you want to be able to have that data stand on its own. It would just have the event_id and athlete_id in it so that you could have that set up. That would also be the PK (Primary Key) for the table and you would then use those two columns as the FK (Foreign Key) to the Performance table that you have at the end. If the data will never exist without times then you could just skip the link table and have the Performance table, although having the link table still wouldn't hurt in that case.
I am working with MS Access 2007. I have 2 tables: Types of Soda, and Likeability.
Types of Soda are: Coke, Pepsi, Dr. Pepper, and Mello Yellow
Likeability is a lookup with these options: Liked, Disliked, No preference
I know how to count the number of Cokes or Mello Yellows in the table using DCount("[Types]", "[Types of Soda]", "[Types]" = 'Coke')
I also know how to count the number of Liked, Disliked, No preference.
("[Perception]", "[Likeability]", "[Perception]" = 'Liked')
But, what if I need to count the number of "Likes" by Type.
i.e. the table should look like this:
Coke | Pepsi | Dr. Pepper | Mello Yellow
Likes 9 2 12 19
Dislikes 2 45 1 0
No Preference 0 12 14 15
I know in Access I can create a cross tab queries, but my tables are joined by an ID. So my [Likeability] table has an ID column, which is the same as the ID column in my [Types] table. That's the relationship, and that's what connects my tables.
My problem is that I don't know how to apply the condition for counting the likes, dislikes, etc, for ONLY the Types that I specify. It seems like I first have to check the [Likeability] table for "Likes", and cross reference the ID with the ID in the [Types] table.
I am very confused, and you may be too, now. But all I want to do is count the # of Likes and Dislikes for each type of soda.
Please help.
Its not really clear (to me anyway) what your tables look like so lets assume the following
tables
Soda
------
Soda_ID (Long Integer (Increment))
Soda_Name (Text(50)
Perception
------
Perception_ID (Long Integer (Increment))
Perception_Name (Text(50)
Likeability
-----------
Likeability_ID (Long Integer (Increment))
Soda_ID (Long Integer)
Perception_ID (Long Integer)
User_ID (Long Integer)
Data
Soda_Id Soda_Name
------- ---------
1 Coke
2 Pepsi
3 Dr. Pepper
4 Mello Yellow
Perception_ID Perception_Name
------------- ---------
1 Likes
2 Dislikes
3 No Preference
Likeability_ID Soda_ID Perception_ID User_ID
-------------- ------- ------------- -------
1 1 1 1
2 2 1 1
3 3 1 1
4 4 1 1
5 1 2 2
6 2 2 2
7 3 2 2
8 4 2 2
9 1 3 3
10 2 3 3
11 3 3 3
12 4 3 3
13 1 1 5
14 2 2 6
15 2 2 7
16 3 3 8
17 3 3 9
18 3 3 10
Transform query You could write a query like this
TRANSFORM
Count(l.Likeability_ID) AS CountOfLikeability_ID
SELECT
p.Perception_Name
FROM
Soda s
INNER JOIN (Perception p
INNER JOIN Likeability l
ON p.Perception_ID = l.Perception_ID)
ON s.Soda_Id = l.Soda_ID
WHERE
p.Perception_Name<>"No Preference"
GROUP BY
p.Perception_Name
PIVOT
s.Soda_Name;
query output
Perception_Name Coke Dr_ Pepper Mello Yellow Pepsi
--------------- ---- ---------- ------------ -----
Dislikes 1 1 1 3
Likes 2 1 1 1