Forum Discussion
Counting a coulumn values from another table
Hi Experts,
I have a table with following values
TABLE 1
Order# Cell Count of station
1 C1 3
2 C2 3
3 C3 3
4 C4 3
I have calculated this count based on another coulumn 'station' in another table which contains some of the values of 'Cell' like
TABLE2
Station
C1
C3
C3
As you can see count in TABLE1 gives sum of count from station.
I want output like this
Order# Cell Count of Station
1 C1 1
2 C2
3 C3 2
4 C4
How this can be achieved. Any help will be appriciated.
I have used following formula for count
Count of station =
CALCULATE(
Count('TABLE2'[station],
ALLSELECTED('TEBLE1'[cell'])
)
Thanks,
- This will work for you.
Count = VAR station = Table1[Cell] RETURN COUNTROWS(FILTER(Table2, Table2[Station] = station))
4 Replies
- Raaz
Helper II
Table1 and Table 2 are related but not directly. There are other tables too.
i.e. Table1 is related to Table3
Table 3 is related to Table 4
Table 4 is related to Table 5 and then
Table5 is related to Table2
I also used simple count, but the output is same as I have written before.
Thanks.
- v-xuding-msft
Community Support
Hi Raaz ,
Because there are many tables and columns in your data model, I think it is better to share us a dummy file to test. That will solve the problem quickly and accurately.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.