Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

count occurrences on related table (Countif) in Powerpivot

$
0
0

I have 2 tables (Groups & Accounts) in PowerPivot that are related by Group Name.  I need to find out how many times each group name occurs in the Accounts table

TableName:Groups

Column1:Group Name

Group A

Group B

Group C

TableName:Accounts

Column1: Account Name, Column2: Group Name

Mike, Group A

John, Group C

Jane, Group A

Emily, Group C

Adam, Group B

Ivan, Group A

I'd like the results to be in the Groups table and look like this:

Column1: Group Name, Column2: # of members

Group A, 3

Group B, 1

Group C, 2

I can get the calculation to work on the Accounts table, but not on the Groups table (where it should be) using this:

=CALCULATE(COUNTROWS('Accounts'), ALLEXCEPT('Accounts', 'Accounts'[Group]))

which i got from this article: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/725597f2-aa4c-4154-ad26-b24319d2758f/dax-expression-to-count-values-within-a-table?forum=sqlkjpowerpivotforexcel

But I can't seem to get it work on the Groups Table using the related data.  

All help is greatly appreciated.  It seems so simple yet I'm struggling!



Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>