Counting a table by groups an item is within

Guitarmageddon

Board Regular
Joined
Dec 22, 2014
Messages
161
Hey folks, I know this is simple and probably related to something with grouping. Ive got a table that is a query result of TABLE names and their COLUMN names within. There are duplicated column names that appear in different tables (many repetitions across tables where these columns are reused).

I'm trying to write a measure that's just showing how many distinct table names you will find that column name within.

For example, you can see that "business unit ID" is found in the three distinct table names shown below. In the example below, the measure below would show a "3" wherever it saw column name "business unit ID"
1709151212567.png
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Cannot manipulate data in a picture. Don't want to have to retype all your data that you already have. Please repost using XL2BB so that we can test solutions before publishing.
 
Upvote 0
Cannot manipulate data in a picture. Don't want to have to retype all your data that you already have. Please repost using XL2BB so that we can test solutions before publishing.
TABLE_NAMECOLUMN_NAME
ACTIVE_PHYSICAL_INV_STYLESBUSINESS_UNIT_ID
ACTIVE_PHYSICAL_INV_STYLESSTYLE_ID
ACTIVE_PHYSICAL_INV_STYLESDOCUMENT_ID
ADD_INFO_DATADATA_SEQUENCE_ID
ADD_INFO_DATAADD_INFO_DATA
ADD_INFO_DATAADD_INFO_KEY_5_DATA
ADD_INFO_DATAADD_INFO_KEY_4_DATA
ADD_INFO_DATAADD_INFO_KEY_3_DATA
ADD_INFO_DATAADD_INFO_KEY_2_DATA
ADD_INFO_DATAADD_INFO_KEY_1_DATA
ADD_INFO_DATAADD_INFO_ID
ADD_INFO_DATAADD_INFO_TABLE_NAME
ADD_INFO_DATABUSINESS_UNIT_ID
ADD_INFO_DATA_ACTIVITYPROCESSED_DATE
ADD_INFO_DATA_ACTIVITYSTATUS
ADD_INFO_DATA_ACTIVITYCREATION_DATE
ADD_INFO_DATA_ACTIVITYACTIVITY_TYPE
ADD_INFO_DATA_ACTIVITYDATA_SEQUENCE_ID
ADD_INFO_DATA_ACTIVITYBUSINESS_UNIT_ID
ADD_INFO_DATA_ACTIVITYUSERNAME
 
Upvote 0
With Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"COLUMN_NAME"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}})
in
    #"Grouped Rows"
Book4
ABCDE
1TABLE_NAMECOLUMN_NAMECOLUMN_NAMECount
2ACTIVE_PHYSICAL_INV_STYLESBUSINESS_UNIT_IDBUSINESS_UNIT_ID3
3ACTIVE_PHYSICAL_INV_STYLESSTYLE_IDSTYLE_ID1
4ACTIVE_PHYSICAL_INV_STYLESDOCUMENT_IDDOCUMENT_ID1
5ADD_INFO_DATADATA_SEQUENCE_IDDATA_SEQUENCE_ID2
6ADD_INFO_DATAADD_INFO_DATAADD_INFO_DATA1
7ADD_INFO_DATAADD_INFO_KEY_5_DATAADD_INFO_KEY_5_DATA1
8ADD_INFO_DATAADD_INFO_KEY_4_DATAADD_INFO_KEY_4_DATA1
9ADD_INFO_DATAADD_INFO_KEY_3_DATAADD_INFO_KEY_3_DATA1
10ADD_INFO_DATAADD_INFO_KEY_2_DATAADD_INFO_KEY_2_DATA1
11ADD_INFO_DATAADD_INFO_KEY_1_DATAADD_INFO_KEY_1_DATA1
12ADD_INFO_DATAADD_INFO_IDADD_INFO_ID1
13ADD_INFO_DATAADD_INFO_TABLE_NAMEADD_INFO_TABLE_NAME1
14ADD_INFO_DATABUSINESS_UNIT_IDPROCESSED_DATE1
15ADD_INFO_DATA_ACTIVITYPROCESSED_DATESTATUS1
16ADD_INFO_DATA_ACTIVITYSTATUSCREATION_DATE1
17ADD_INFO_DATA_ACTIVITYCREATION_DATEACTIVITY_TYPE1
18ADD_INFO_DATA_ACTIVITYACTIVITY_TYPEUSERNAME1
19ADD_INFO_DATA_ACTIVITYDATA_SEQUENCE_ID
20ADD_INFO_DATA_ACTIVITYBUSINESS_UNIT_ID
21ADD_INFO_DATA_ACTIVITYUSERNAME
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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