Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I'm trying to replicate Excel's countifs function. I've seen a couple other posts but I'm new to DAX and not totally clear how to do this.
How do I create a DAX formula that evaluates three separate columns and returns the count of how often the rows repeat?
Below I've created what I want in Excel. Column AK is what I want to create in DAX
I tried just evaluating one column to get me started and I'm clearly doing something wrong. Here is the formula I tried:
Solved! Go to Solution.
Hi @Anonymous
use below dax, it should work
Countifs=
var delivery = 'Table'[Delivery]
var salesdoc = 'Table'[SalesDoc]
var item = 'Table'[Item]
RETURN
COUNTROWS(
FILTER(
all('Table'),
delivery='Table'[Delivery] &&
salesdoc=''Table'[SalesDoc] &&
item='Table'[Item]))
Please change the table name as per your table name, please let me know if this works for you.
Hi @Anonymous
use below dax, it should work
Countifs=
var delivery = 'Table'[Delivery]
var salesdoc = 'Table'[SalesDoc]
var item = 'Table'[Item]
RETURN
COUNTROWS(
FILTER(
all('Table'),
delivery='Table'[Delivery] &&
salesdoc=''Table'[SalesDoc] &&
item='Table'[Item]))
Please change the table name as per your table name, please let me know if this works for you.
It worked! I had to change "item" to "item1" because I got a red error line, but now it worked.
Can you tell me how this is working so I can learn please?
Hi @Anonymous
Very glad it worked for you, in order to answer your question.
Basically it's similar logic of countifs in excel.
We are filtering all three columns with 'AND' operator as per the criteria at row level and then counting the rows. Hope this helps, feel free to ask more questions.
Thanks
Proud to be a Super User!
My data has double counts in it for some columns but not others.
For the columns that have double counts I want to adjust the values (by creating a new column) to reflect the double counting. E.g., there are delivery expenses that show up multiple times. The delivery expense in total is $10...but the row is repeated three times so when it's summed together it's $30. I want to add another column that divides by how often there is double counting. So, to continue the example the # of double counts might be 3 so I take $30 / 3 = $10 so I can sum correctly.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 32 | |
| 27 | |
| 26 |