cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

## Count only Code  A and B if it is same in any ID

Hi Team,

I am trying to count only Code  A & B if it same in any ID , any thoughts

 ID Code 1002 A 1002 B 1002 C 1003 A 1003 D 1003 C 1004 A 1004 B 1005 A 1005 C 1005 D

 id A B C D 1002 1 1 1 1003 1 1 1 1004 1 1 1005 1 1 1

Result will be 2 as a count , A & B  for 1002 & 1004 as per criteria

2 ACCEPTED SOLUTIONS
Super User

Hi,

I am not sure I fully understood, but try something like this:

Count A/B =
IF(
COUNTROWS(
FILTER(
'Table (7)','Table (7)'[Code]="A" || 'Table (7)'[Code]="B"))>1,1,0)

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

Proud to be a Super User!

Anonymous
Not applicable

Hello

Mesure =
var idrech=SELECTEDVALUE(Feuil3[ID ])
var step_1=filter(SUMMARIZE(Feuil3,Feuil3[ID ],Feuil3[Code]),Feuil3[Code] in {"A","B"})
var result =countrows(step_1)
return
if (result>1, result)
4 REPLIES 4
Anonymous
Not applicable

Hello

Mesure =
var idrech=SELECTEDVALUE(Feuil3[ID ])
var step_1=filter(SUMMARIZE(Feuil3,Feuil3[ID ],Feuil3[Code]),Feuil3[Code] in {"A","B"})
var result =countrows(step_1)
return
if (result>1, result)
Anonymous
Not applicable

Thanks it working correctly.

Super User

Hi,

I am not sure I fully understood, but try something like this:

Count A/B =
IF(
COUNTROWS(
FILTER(
'Table (7)','Table (7)'[Code]="A" || 'Table (7)'[Code]="B"))>1,1,0)

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

Proud to be a Super User!

Anonymous
Not applicable

Amazing approach , Could you please add 1 more thing how can display 1 ( which are matching) by DAX in same Measures

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.