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
_nerdy
Frequent Visitor

Count rows with measure equal to x

Hi,

I'm trying to write a new measure that returns a count of rows where an existing measure equals 1. I've tried many different approaches, the latest being:

NewMeasure = COUNTROWS(FILTER('MyTable', [MyExistingMeasure] <> 0 ))

and

NewMeasure = CALCULATE([MyExistingMeasure],FILTER(VALUES(MyTable),[MyExistingMeasure]=1))

etc.

 

The existing measure returns a 1 when its conditions are met or 0 when not. I am pretty sure it is working as expected as I can apply a filter to a table visual with the parameter "MyExistingMeasure is 1" and it only shows rows I'd expect to see.

 

I am trying to create a card that shows the total count of rows with a 1 in that measure and thought a new measure that creates the counts would be the way to go.

 

Stumped. Help appreciated.

 

Regards,

_nerdy

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@_nerdy , to count a measure you need a context or grouping level, Assume you have id

 

example measure

Countx(filter(values(MyTable[ID]) ,[MyExistingMeasure] =1), [ID])

 

 

of use visual level filter MyExistingMeasure =1

 

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@_nerdy , to count a measure you need a context or grouping level, Assume you have id

 

example measure

Countx(filter(values(MyTable[ID]) ,[MyExistingMeasure] =1), [ID])

 

 

of use visual level filter MyExistingMeasure =1

 

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

This just helped solve my problem 😁

Thanks

Solved my problem too! TY!

Amazing, thank you! 😁

ALLUREAN
Solution Sage
Solution Sage

Hi, @_nerdy 

Try this:

CALCULATE(COUNTROWS('MyTable'),FILTER('MyTable', [MyExistingMeasure]1)) 

 




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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