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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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