locked
How to group by count with condition in powerquery RRS feed

  • Question

  • Hello. I want to group by customer and then count the number of invoices that they have, but I only want to count the invoice if it is over $5. Can I do this in power query? Thanks. 
    Thursday, August 4, 2016 11:24 PM

Answers

  • Invoice Count would be your measure to get the value of invoices >5. Without a relation it will count all invoices over 5.

    I assume you would have a relation to the invoices by customer number or something that would restrict the count to related invoices. Start with your customer list and add the invoice count to the table.

    Wednesday, September 7, 2016 6:46 PM

All replies

  • Invoice Count:=Calculate( Countrows(Invoices), Filter(Invoices, Invoices[amount]>5))
    Friday, August 5, 2016 6:47 PM
  • Hello. I'm not sure that's right. The customer table is a "One" table and the invoices table is a "Many" table attached to customer table. I think this would only look at the invoices by themselves. 
    Friday, August 19, 2016 11:08 PM
  • Invoice Count would be your measure to get the value of invoices >5. Without a relation it will count all invoices over 5.

    I assume you would have a relation to the invoices by customer number or something that would restrict the count to related invoices. Start with your customer list and add the invoice count to the table.

    Wednesday, September 7, 2016 6:46 PM