cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dnana
Microsoft
Microsoft

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
Super User
Super User

// 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
Super User
Super User

// 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]
)

Thank your help. I appreciate the explanation!

Helpful resources

Announcements
collabdays lisbon

CollabDays Lisbon - 26 November 2022

Sessions include practical, hands-on experience that will help you take the next step in your career and know-how.

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.