Multi table lookup and count

Ucubia

Board Regular
Joined
Mar 17, 2010
Messages
90
Hi

I have two tables Hosts, and Applications

"Hosts" contains a list of unique server platforms being used, for the purposes of this thread the range being Server001-Server100
"Applications" contains a list of applications and the platform they reside upon, therefore there could be a single application upon a dedicated server, or there could be multiple applications sharing a server - for example

Application001 Server001
Application002 Server001
Application002 Server002
Application003 Server003
Application004 Server004
Application005 Server004
Application006 Server004

Ideally, want to add a column to identify the number of application each server to associated to, thus the output being:

Server001 2
Server002 1
Server003 1
Server004 3

I am stuck and struggling to understanding the easiest method to calculate the information when using multiple tables - I thought COUNTROWS might be the answer but to get the count would essentially mean I have to filter for each individual server which for the example would be challenging 1-100 but in reality the host list runs into multiple '00s

Any help gratefully received.

Many thanks, Ian
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Use Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"Column2"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"

Book2
ABCDE
1Column1Column2Column2Count
2Application001Server001Server0012
3Application002Server001Server0021
4Application002Server002Server0031
5Application003Server003Server0043
6Application004Server004
7Application005Server004
8Application006Server004
Sheet1


Alternatively if you are using O365 Beta Insider then you can use GroupBy function
Excel Formula:
=GROUPBY(Table1[Column2],Table1[Column2],COUNTA)
 
Last edited:
Upvote 0
Hi Alan

Thank you for your reply

Would this work within Power BI ? I mentioned earlier the customer is using Power BI as the Hosts table is Excel and the Application table is SQL

Thanks
 
Upvote 0
Yes. You will need to open PQ in PBI. I don't work with PBI, but my understanding it should be easy to do except I don't know the exact steps to open PQ.
 
Upvote 0
@Ucubia
PBI is built on PowerQuery. Right click on the imported table to edit the query.

Or you could add a new table with DAX (same output)

Excel Formula:
Grouped_Table = SUMMARIZE(Tabel,[Column2], "Count", COUNT(Tabel[Column2]))

1709575023794.png
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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