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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors