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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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

v-nuoc-msft
Community Support
Community Support

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
v-nuoc-msft
Community Support
Community Support

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.