Forum Discussion
bidataservices
3 years agoFrequent Visitor
COUNTIFS in DAX
Can anybody please help with a DAX question. I have a report in Excel that counts the items that make up an invoice. I have atached a screenshot with the Excel formula highlighted. I am trying to rec...
tamerj1
Community Champion
3 years agoHi bidataservices
Please refer to attached sample file with the solution
Item Count =
IF (
'Table'[InvoiceType] <> "Item",
COUNTROWS (
CALCULATETABLE (
'Table',
'Table'[InvoiceType] = "Item",
ALLEXCEPT ( 'Table', 'Table'[Document], 'Table'[Item], 'Table'[City] )
)
) + 0
)bidataservices
3 years agoFrequent Visitor
Thanks, that worked well.
What if I wanted to do a SUMIFS on sales?
- tamerj13 years ago
Community Champion
bidataservices
You mean like this?Item Sales = IF ( 'Table'[InvoiceType] <> "Item", SUMX ( CALCULATETABLE ( 'Table', 'Table'[InvoiceType] = "Invoice", ALLEXCEPT ( 'Table', 'Table'[Document], 'Table'[Item], 'Table'[City] ) ), 'Table'[Sales] ) + 0 )