Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
newpbiuser01
Helper V
Helper V

Using Summarize with Countrows and Filter Functions in a Dax Measure

Hello,

 

I am trying to use the countrows function to get the unique count of records in a function. How can I use the I tried using the following function:

#Records = Countrows( Filter( Summarize ('Order Data', 'Order Data'[Order Number], 'Order Data'[Status])), [Status] = "Delivered")) 

But I keep getting an incorrect syntax error saying - "The syntax for ) is incorrect". What am I doing wrong? 

 

How can I use countrows, filter and summarize functions together? 

 

I'd appreciate any help!

 

3 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

No need for summarize - better stay away from that function, it has lots of dirty secrets

 

#Records = Countrows(SUMMARIZECOLUMNS('Order Data'[Order Number],TREATAS({"Delivered"},'Order Data'[Status])))

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Try this

#Records = Countrows( Filter( Summarize ('Order Data', 'Order Data'[Order Number], 'Order Data'[Status]), [Status] = "Delivered")) 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Anonymous
Not applicable

Hi @newpbiuser01 

 

Thank you very much Ashish_Mathur and lbendlin for your prompt reply.

 

I checked your code carefully and the problem is that there is an extra ")" in the screenshot position. You can try to modify it.

 

vnuocmsft_1-1736127796326.png

 

The correct code should be as provided by Ashish_Mathur.

 

vnuocmsft_0-1736127743089.png

 

Or you can try the method provided by lbendlin which will also give you the results you want.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @newpbiuser01 

 

Thank you very much Ashish_Mathur and lbendlin for your prompt reply.

 

I checked your code carefully and the problem is that there is an extra ")" in the screenshot position. You can try to modify it.

 

vnuocmsft_1-1736127796326.png

 

The correct code should be as provided by Ashish_Mathur.

 

vnuocmsft_0-1736127743089.png

 

Or you can try the method provided by lbendlin which will also give you the results you want.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

Try this

#Records = Countrows( Filter( Summarize ('Order Data', 'Order Data'[Order Number], 'Order Data'[Status]), [Status] = "Delivered")) 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

No need for summarize - better stay away from that function, it has lots of dirty secrets

 

#Records = Countrows(SUMMARIZECOLUMNS('Order Data'[Order Number],TREATAS({"Delivered"},'Order Data'[Status])))

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.