Many 2 Many Store Count Row to Field Context

PaulGotts

New Member
Joined
Nov 5, 2012
Messages
29
Hello All,

I've been struggling with an issue and was wondering if anyone might lend some guidance.

3 tables exist in my data model...
I. Store, ProductCategory
II. Store
III. Store, UnitSales, DollarSales

A many to many relationship exists between tables i & iii via ii.

I am trying to return the # of stores that share a Product Category and have Sales above a certain amount.


So far, I've used a calculated column in TableI to get the number of stores which share the product category...

PC1:=CALCULATE(
COUNTROWS(TableI),
MID(TableI[ProductCategory],17,4)="C123",
FILTER(TableI,
TableI[ProductCategory]=EARLIER(TableI[ProductCategory],1)
)
)

Then, because each Store could have up to 2 "C123" Product Categories, I made a couple Calculated Fields...

PC1A:=MIN(TableI[PC1])

PC1B:=IF(
SUM(TableI[PC1])-MIN(TableI[PC1])=0,
blank(),
SUM(TableI[PC1])-MIN(TableI[PC1])
)

Now, I am trying to countrows of TableII by filtering based on the formulae shown above AND new formula(e) from TableIII (yet to be made).

I've tried the formula below to no avail...

SortTableII:=CALCULATE(COUNTROWS(TableII),

FILTER(TableII,
CALCULATE(COUNTROWS(TableI),
FILTER(TableI,
MID(TableI[ProductCategory],17,4)="C123"),
FILTER(TableI,TableI[ProductCategory]=EARLIEST(TableI[ProductCategory])))>0),

FILTER(TableII,
CALCULATE(COUNTROWS(TableIII),
FILTER(TableIII,
[UnitSales]>0||(2*ABS([UnitSales]))<[DollarSales]))>0)
)


Any thoughts?

Thanks kindly,
Paul G.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top