Forum Discussion
Aruljoy
Helper II
4 years agoCount members based on Measure result
Hi, 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]=...
TheoC
Community Champion
4 years agoAruljoy 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:
Let me know how it goes Aruljoy
Cheers,
Theo
Aruljoy
Helper II
4 years agoI tried the above DAX query for my logic, still count is not matching
- TheoC4 years ago
Community Champion
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
_2Your output is wrong because of the = sign per below:
Once this is corrected, the output will be correct.
Thanks,
Theo