CoffeeGuru
Registered User.
- Local time
- Today, 08:38
- Joined
- Jun 20, 2013
- Messages
- 121
Hi
I am trying to count how many plans a retail chain has over its stores.
So
WeekNo | StoreNo | Product |PlanNo
1 | 10001 | Dog | A
1 | 10001 | Cat | B
1 | 20008 | Dog | B
1 | 30005 | Dog | B
Query/report to show
Product | PlanNo A | PlanNo B
Dog | 1 | 2
Cat | 0 | 1
Numbers in Query/report are a count of Stores selling the product
One of the issues is that the data is duplicated over the weeks, I'm thinking to use max on week number so It only looks at the last available data but open to any ideas that will work better.
And how to write the query.
Currently I'm doing this
PlanA: Sum(IIf([PlanNo]="A",1,0)
PlanB: Sum(IIf([PlanNo]="B",1,0)
.
.
.
But it looks at the whole of the table for all the weeks
Can anyone come up with how to get around this.
I am trying to count how many plans a retail chain has over its stores.
So
WeekNo | StoreNo | Product |PlanNo
1 | 10001 | Dog | A
1 | 10001 | Cat | B
1 | 20008 | Dog | B
1 | 30005 | Dog | B
Query/report to show
Product | PlanNo A | PlanNo B
Dog | 1 | 2
Cat | 0 | 1
Numbers in Query/report are a count of Stores selling the product
One of the issues is that the data is duplicated over the weeks, I'm thinking to use max on week number so It only looks at the last available data but open to any ideas that will work better.
And how to write the query.
Currently I'm doing this
PlanA: Sum(IIf([PlanNo]="A",1,0)
PlanB: Sum(IIf([PlanNo]="B",1,0)
.
.
.
But it looks at the whole of the table for all the weeks
Can anyone come up with how to get around this.