Forum Discussion
How to replicate Excel COUNTIF formula?
I am struggling to get my head around the basic layout of DAX, even a simple COUNTIF formula. I have two tables in my data model connected by a field called System. I just wanted to calculate in this table how many rows are in Table 1 where the two row values for System are the same.
JollyRoger01
I guess you have a one-to-many relationship from this table to table1. Add the following calculated column to the table on the one sideCount System = CALCULATE( COUNTA(Table1[System]), RELATEDTABLE(Table1) )
6 Replies
- FowmySuper User
JollyRoger01
I guess you have a one-to-many relationship from this table to table1. Add the following calculated column to the table on the one sideCount System = CALCULATE( COUNTA(Table1[System]), RELATEDTABLE(Table1) )- JollyRoger01Helper III
Thank you, that seems to work. Though I am a little confused as to what the function is actually doing. How does it know that I am trying to match the two columns? Is that implied from the one to many relationship already?
- FowmySuper User
JollyRoger01
Yes, since you already have a valid relationship, CALCULATE activates it here.