Forum Discussion

cindychanyy's avatar
cindychanyy
New Member
2 years ago
Solved

How to count rows with conditions in Power Query

I have a dataset with country, date, and customer details. I need to summarise the dataset and show the number of customers in a country in a month. 

I need two numbers of customers, 1) crude number of customers and 2) number of customers if their [DaysPrevalent] >=1. How should I revise my query (highlighted part) to get the prevalent customer number? Thank you!

 

 

 

  • Hi cindychanyy, try to replace code in curly brackets for PrevalentCustomers with this:

     

     

    {"PrevalentCustomers", each List.Count(List.Select([DaysPrevalent], (x)=> x >= 1)), Int64.Type}

     

3 Replies

  • dufoq3's avatar
    dufoq3
    Community Champion

    Hi cindychanyy, try to replace code in curly brackets for PrevalentCustomers with this:

     

     

    {"PrevalentCustomers", each List.Count(List.Select([DaysPrevalent], (x)=> x >= 1)), Int64.Type}