excel - Counting cells in related table with powerpivot -


in powerpivot have 2 tables, , in both of them have column called id, , id not unique on both tables.

i wanted able count how many id occurences have in other table. i've tried different forms of calculate countrows and/or relatedtable, nothing worked.

at end of day, if there other solution shows me list of ids in both tables, work me.

some example on what's going on:

the tables this:

table1 id            revenue 123us         100 321de         200  table2: account       campaign        id xyz             usa          123us abc             usa          123us asd             ger          321de 

sorry format. first, tried create relationship between tables, there multiple values [id] in both tables, wasn't possible. then, tried, example, add column in table1:

=calculate(countrows('table2'),'table1'[id]='table2'[id]))

but didn't worked.

edit: added example , fixed formatting.

you close!

the calculate function takes table , filter(s). correctly put in table, in dax need wrap desired filter in filter function.

on table1 use following formula count items on table2 have same id

=calculate(countrows(table2),filter(table2,table2[id]=table1[id])) 

on table2 use following formula count items on table1 have same id

=calculate(countrows(table1),filter(table1,table1[id]=table2[id])) 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -