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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Aruljoy
Helper II
Helper II

Count members based on Measure result

Hi,

 

Aruljoy_0-1646075928954.png

I want to count the no of members who has FailOnlyFlag=1. FailonlyFlag is a measure basen columns measure_Successcount & Measure_failcount

 

FailOnlyFlag = if([Measure_Successcount]=0 && [Measure_Failcount] > 0 , "1", "0")

 

Can you please let me know how to get the count of members whos flag is 1?

1 ACCEPTED SOLUTION

@Aruljoy you used the wrong measure.  You have = 0 instead of > 0. Please fix your measure and try again.

 

TheoC_0-1646116326688.png

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

17 REPLIES 17
laurenN
Regular Visitor

@TheoC Hello! I have the same issue but in a different scenario and I've tried to steal the solution you have created for Aruljoy but it's not working for me so I'm clearly missing something - please could you help?!

 

I have a table with date of update, project reference number and current RAG status - this pulls into my report as "RAG Outcome" column and contains either "RED", "AMBER" or "GREEN".  

 

In order to build a measure to return whatever the most recent RAG is for any given project - so only one result per project but that result could be March's update, or June's update etc etc.  So to do that I used LASTNONBLANKVALUE, which needed a measure, not a column value so have ended up with...

 

laurenN_1-1653320864637.png

Then I have the measure which gives me the latest RAGs only - which works for me

 

laurenN_0-1653320527077.png

And have another measure to convert those names into RAG colour numbers for easier conditional formatting of other tables..

laurenN_2-1653320969125.png

I tried to play around with your solution above but it's not giving me what I need...

laurenN_3-1653321067301.png

I'm after three separate measures which just count how many GREEN/AMBER/RED rags there are in the latest RAG values measure/output.  All my attempts have either added up all of them regardless of date/being most recent or not done anything. I'd be so grateful if you could make sense of this for me - I've spent hours on it already and going stir crazy 🙂

 

Thank you

- Lauren

Hi @laurenN 

 

Apologies for the late reply.  I am not sure the two issues align quite as would be required to give you the solution that you're after.

 

Given this is a closed post, can you do me a massive favour and add a new post?  Also, can you just provide a sample of the data that you are dealing with so that I (or another member of our Community) can better understand it and provide a solution efficiently?

 

Thanks heaps and please feel free to tag me in the post or in a comment once you've made the initial post.

 

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@TheoC Thank you so much for getting back to me - I managed to somehow find a solution yesterday in the end - perhaps not as elegant as it could be but it does the job - I used this:

laurenN_0-1653464961517.png

and it's giving me the desired results.  Thank you so much for your time anyway though Theo, I appreciate it

@laurenN  love it! Well done on getting a solution! 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

sevenhills
Super User
Super User

Fail Only Flag = 
var _a = COUNTROWS( Filter( 'Table', if ( 'Table'[Measure_SuccesCount] = 0 && 'Table'[Measure_FailCount] > 0, 1, 0)))
RETURN If (ISBLANK(_a), 0, _a)

 

Try this

 

Aruljoy_1-1646095833112.png

 

Measure_Successsount & Measure_failcount are also measures.  Eg, The first row should return as 0, but I am getting 36.

Measure_Successcount =
Var Result = CALCULATE(countrows(TransactionData),FILTER(TransactionData,TransactionData[TransactionTypeDerived]="success"))
Return if(isblank(Result)=TRUE(),0,result)

 

 

Measure_Failcount =
--Var StarDate = MIN(DimDate[TransactionDate])
--Var EndDate = max(DimDate[TransactionDate])
Var Result = CALCULATE(countrows(TransactionData),FILTER(TransactionData,TransactionData[TransactionTypeDerived]="fail"))
Return if(isblank(Result)=TRUE(),0,result)

In your original post, you said as "....measure basen columns"

 

DAX behave differently for measures vs columns.

 

Try this:

 

Fail Only Flag 2 = 
var _a = if ([Measure_FailCount] > 0 && [Measure_SuccesCount] = 0, 1, 0)  
var _t1 = SUMMARIZE('Table','Table'[MemID], "__Value1",  if ([Measure_FailCount] > 0 && [Measure_SuccesCount] = 0, 1, 0) )

RETURN If( HASONEVALUE('Table'[MemID]), _a, Sumx(_t1, [__Value1]))

 

TheoC
Super User
Super User

Hi @Aruljoy 

 

Just remove the quotations around the 1. By using "1" instead of 1, Power BI is taking it that you want text instead of a value. Make sure to do the same for 0.  You may need to ensure the format is set to Whole Number too in the top ribbon.

 

Hopefully this gets you the result you're after. If not, let me know 🙂

 

Hope this helps.

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Thanks @TheoC  for the reply. But still there no count in the total

Hi @Aruljoy did you do it as a measure or a column?

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

its a measure

@Aruljoy try this:

 

Measure = 

VAR _1 = COUNTROWS ( FILTER ( VALUES ( 'Table'[MemID] ) , [Measure_SuccessCount] > 0 ) )
VAR _2 = IF ( _1 > 0 , COUNTROWS ( FILTER ( VALUES ( 'Table'[MemID] ) , [Measure_SuccessCount] > 0 ) ) , 0 )

RETURN

_2

 

You can also use ISBLANK to replace the VAR _2 but it's much of a muchness.

 

Measure = 

VAR _1 = COUNTROWS ( FILTER ( VALUES ( 'Table'[MemID] ) , [Measure_SuccessCount] > 0 ) )
VAR _2 = IF ( ISBLANK ( _1 ) , 0 , _1 )

RETURN

_2

Also, just below is a screenshot of the output:

TheoC_0-1646099215067.png

Let me know how it goes @Aruljoy 

Cheers,

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Aruljoy_0-1646113945294.png

I tried the above DAX query for my logic, still count is not matching

Hi @Aruljoy please use the measure as it's written.  You need to use > and not the = sign.

 

Measure = 

VAR _1 = COUNTROWS ( FILTER ( VALUES ( 'Table'[MemID] ) , [Measure_SuccessCount] > 0 ) )
VAR _2 = IF ( _1 > 0 , COUNTROWS ( FILTER ( VALUES ( 'Table'[MemID] ) , [Measure_SuccessCount] > 0 ) ) , 0 )

RETURN

_2

  Your output is wrong because of the = sign per below:

TheoC_1-1646116489171.png

Once this is corrected, the output will be correct.

 

Thanks,

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@Aruljoy you used the wrong measure.  You have = 0 instead of > 0. Please fix your measure and try again.

 

TheoC_0-1646116326688.png

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Thanks @TheoC . This works for me..

@Aruljoy no trouble at all! All the best 👍 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors