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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.