Forum Discussion
Calculate Occurrence
Hello ,
I am looking for some help around the solution for below.
Table A(column 1) Table B(Column 2)
1 Tom
1 Harry
1 Nick
2 Tim
2 Sam
Looking for a result that counts the occurence of Column 1.
Table A(column 1) Table B(Column 2) Result Count
South Tom 3
South Harry 3
South Nick 3
North Tim 2
North Sam 2
Thank you in advance.
Hi Anonymous ,
According to your requirements, the table relationships in the data model are many-to-many relationships. I did the following test as a reference:M = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( ALL ( Table1 ), Table1[Area] = MAX ( Table1[Area] ) ) )
If the established model is not correct, please provide detailed test data and information so that I can do accurate tests. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- parry2k
Super User
Anonymous what is the logic to get the count? What is the relationship between these tables?
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- AnonymousNot applicable
Hello Parry2k,
The relationship between these 2 tables is with a different column with Many to Many relation. All I am looking for is the count of number of occurences of the records in Column 1 irrespective of column 2.
- smpa01
Community Champion
Anonymous
Measure 2 := CALCULATE(COUNTROWS('Table'),ALL('Table'[Column2]))- AnonymousNot applicable
Thank you for the response. This logic did not work as both columns are not from the same table.
- v-henryk-mstf
Community Support
Hi Anonymous ,
According to your requirements, the table relationships in the data model are many-to-many relationships. I did the following test as a reference:M = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( ALL ( Table1 ), Table1[Area] = MAX ( Table1[Area] ) ) )
If the established model is not correct, please provide detailed test data and information so that I can do accurate tests. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.