Lookup table count on data table RRS feed

  • Question

  • Hello. I have a lookup table of customers. Each customer has invoices but I want to get a count of invoices that are ONLY of a certain criteria. How can I adjust the formula below to only SUM, if another column in that table is a certain value? 

    =SUMX(RELATEDTABLE('Invoices'),'Invoices'[Invoice Count])

    Tuesday, October 11, 2016 9:35 PM


  • If you already have a relationship between Invoices and Customers you don't need to use the RelatedTable function, the DAX engine will automatically follow the relationships. You really only need RelatedTable when you are calculating something in a row context (like when you are creating a calculated column)

    You should be able to do the following:

    =CALCULATE( SUM( 'Invoices'[Invoice Count]), 'Invoices'[Other Column] = "Value")

    http://darren.gosbell.com - please mark correct answers

    • Proposed as answer by Olaf HelperMVP Wednesday, October 12, 2016 6:15 AM
    • Marked as answer by AlexMartini Thursday, October 13, 2016 6:44 PM
    Tuesday, October 11, 2016 10:01 PM