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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
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
1002A
1002B
1002C
1003A
1003D
1003C
1004A
1004B
1005A
1005C
1005D

 

idABCD
1002111 
10031 11
100411  
10051 11

 

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

2 ACCEPTED SOLUTIONS
ValtteriN
Super User
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)

ValtteriN_0-1661237165669.png

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!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Anonymous
Not applicable

Hello

 

Please try this measure

JamesFr06_0-1661237304700.png

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)

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hello

 

Please try this measure

JamesFr06_0-1661237304700.png

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.

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

ValtteriN_0-1661237165669.png

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!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/







Did I answer your question? Mark my post as a solution!

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.