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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
wbart
Helper I
Helper I

Determine common elements from several conditions

Hello,

I want to extract common values and count them. The table looks like this:

namecondition

A

1
B1
C1
D2
A2
C2

 As a result I want to have the infomation that names A and C belong to the conditions 1 and 2. I want to count the amount of names which have conditions in common and I want to list (show this elements.) How do I do this?

 

Best regards

wbart

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @wbart 

you can try this.

-

create a table

 

common condition = 
var _tab1=SELECTCOLUMNS(FILTER('Table','Table'[condition]=1),"name1",'Table'[name])
var _tab2=SELECTCOLUMNS(FILTER('Table','Table'[condition]=2),"name2",'Table'[name])
return
INTERSECT(_tab1,_tab2)

 

then, create the count measure:

 

count = CALCULATE(DISTINCTCOUNT('common condition'[name1]),ALL('common condition'))

 

result:

vxiaotang_0-1626848754768.gif

-

OR

you can try this, and set "is not 1"

countDistinct = CALCULATE(DISTINCTCOUNT('Table'[condition]),ALLEXCEPT('Table','Table'[name]))

result:

vxiaotang_0-1628586023683.png

by the way, if you want the most frequent, you can set TopN for name like bellow

vxiaotang_1-1628586156496.png

 

 

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @wbart 

you can try this.

-

create a table

 

common condition = 
var _tab1=SELECTCOLUMNS(FILTER('Table','Table'[condition]=1),"name1",'Table'[name])
var _tab2=SELECTCOLUMNS(FILTER('Table','Table'[condition]=2),"name2",'Table'[name])
return
INTERSECT(_tab1,_tab2)

 

then, create the count measure:

 

count = CALCULATE(DISTINCTCOUNT('common condition'[name1]),ALL('common condition'))

 

result:

vxiaotang_0-1626848754768.gif

-

OR

you can try this, and set "is not 1"

countDistinct = CALCULATE(DISTINCTCOUNT('Table'[condition]),ALLEXCEPT('Table','Table'[name]))

result:

vxiaotang_0-1628586023683.png

by the way, if you want the most frequent, you can set TopN for name like bellow

vxiaotang_1-1628586156496.png

 

 

 

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Thanks #v-xiaotang,

I stil try to get this running :). I'll get back to you.

Best regards

wbart

Hi @wbart 

Have you solved this problem? If yes, could you kindly accept the answer helpful as the solution (or kindly share your solution ). so the others can find it more quickly.
really appreciate!
Any question, please let me know. Looking forward to receiving your reply.

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.