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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PowerbiGuest23
Frequent Visitor

Check if value is in a filtered list DAX

I am tring to create a measure determining if an attribute is the same as that of an item selected by a slicer. Using the example below, the column "Is Selected" returns 1 if a Team was chosen using a slicer. I am trying to create the column "Same Color" that returns 1 if the Uniform Color is the same as the team where "Is Selected" is 1.

 

In other words, here is the logic I am trying to implement in DAX: if UniformColor is in list of UniformColors of the "Is Selected" team, return 1.

 

TeamUniform Color  Is Selected   Same Color   
ARed11
AWhite11
BGreen00
BRed01
CBlue00
CWhite01

 

 

I have a DAX query that I feel is close, but it only displays results for the selected team and is blank for every other team.

 

RelevantUnit =
var TableVar = DISTINCT(SELECTCOLUMNS(FILTER('Team',[Is Selected] = 1),"SimilarColor",'Team'[Uniform Color]))
return CALCULATE(COUNTROWS('Team'),'Team'[Uniform Color] in TableVar)

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@PowerbiGuest23 , First of all, a column can not use selectedvalue or the slicer value. So you need to create a measure

You need an independent team table for slicer

 

Measure  =

var _sel = summarize(Filter(Table, Table[Team] = selectedvalue(Team[Team]) ), Team[Color])

return

countrows(filter(Table, Table[color] in _sel))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

v-easonf-msft
Community Support
Community Support

Hi, @PowerbiGuest23 

Please try formulas as below:

 

Is Selected = 
var a=IF(SELECTEDVALUE(Team[Team]) in VALUES('Slicer Team'[Team]),1,0)
return IF(ISFILTERED('Slicer Team'[Team]),a,0)
Same color = 
var tab=SUMMARIZE(Filter(all(Team), Team[Team] in values('Slicer Team'[Team]) ), Team[Uniform Color])
var b=IF(SELECTEDVALUE(Team[Uniform Color]) in tab,1,0)
return IF(ISFILTERED('Slicer Team'[Team]),b,0)

 

veasonfmsft_0-1656405242301.png

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @PowerbiGuest23 

Please try formulas as below:

 

Is Selected = 
var a=IF(SELECTEDVALUE(Team[Team]) in VALUES('Slicer Team'[Team]),1,0)
return IF(ISFILTERED('Slicer Team'[Team]),a,0)
Same color = 
var tab=SUMMARIZE(Filter(all(Team), Team[Team] in values('Slicer Team'[Team]) ), Team[Uniform Color])
var b=IF(SELECTEDVALUE(Team[Uniform Color]) in tab,1,0)
return IF(ISFILTERED('Slicer Team'[Team]),b,0)

 

veasonfmsft_0-1656405242301.png

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@PowerbiGuest23 , First of all, a column can not use selectedvalue or the slicer value. So you need to create a measure

You need an independent team table for slicer

 

Measure  =

var _sel = summarize(Filter(Table, Table[Team] = selectedvalue(Team[Team]) ), Team[Color])

return

countrows(filter(Table, Table[color] in _sel))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.