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
dnana
Microsoft Employee
Microsoft Employee

Count the result of a measure

On a previous post I received amazing help in: "Filter single column with multiple conditions (words in a string)"

 

Solved: Re: Filter single column with multiple conditions ... - Microsoft Power BI Community

 

Find text that has "red" and "green" in single column

 

Selector Measure = 
  VAR __Name = MAX('Table'[NAME])
  VAR __Table = SUMMARIZE('Table',[NAME],"__STRING",CONCATENATEX('Table',[STRING]))
  VAR __Table1 = ADDCOLUMNS(__Table,"__Red",SEARCH("red",[__STRING],,0),"__Green",SEARCH("green",[__STRING],,0))
  VAR __Names = DISTINCT(SELECTCOLUMNS(FILTER(__Table1,[__Red]>0 && [__Green]>0),"__Name",[NAME]))
RETURN
  IF(__Name IN __Names,1,0)

 

 

Measure_Result_g.jpg

 

Measure_Result.jpg

 

I want to count the results of the Measure and followed this post and few others but could not get it to work.

Solved: Is it possible to count the result of a measure? - Microsoft Power BI Community

 

As always, any insight would be appreciated!

@Greg_Deckler 🙂

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

// You can hide the [Selector Measure]
// from the user's view and use the following
// instead. It'll do what the other does
// and also will summarize correctly unlike the other.
// You can also replace the [Selector Measure]
// with its body inside the new measure and
// then get rid of the old one completely.
// Up to you.

[Your New Measure] =
sumx(
    values( 'Table'[Name] ),
    [Selector Measure]
)

View solution in original post

2 REPLIES 2
daXtreme
Solution Sage
Solution Sage

// You can hide the [Selector Measure]
// from the user's view and use the following
// instead. It'll do what the other does
// and also will summarize correctly unlike the other.
// You can also replace the [Selector Measure]
// with its body inside the new measure and
// then get rid of the old one completely.
// Up to you.

[Your New Measure] =
sumx(
    values( 'Table'[Name] ),
    [Selector Measure]
)
dnana
Microsoft Employee
Microsoft Employee

Thank your help. I appreciate the explanation!

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.