Forum Discussion
How to create countifs in DAX - replicate Excel countifs
- 6 years ago
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.
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.