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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
tt211595
Frequent Visitor

Measure with rowwise IN operator

Hello! I am trying to create a measure that returns TRUE and FALSE for each row of a table based on a slicer selection.

 

For example, say I have a table called MyTable with two columns named ID and Color:

IDColor

1

red

2

green
3red
4red
5blue
6yellow

 

I've created a table called AllColors = VALUES('MyTable'[Color]) and I've created a slicer to allow the user to select colors. In this example, the user has selected "red" and "yellow" in the slicer.

 

I would like to create a measure called MyMeasure that returns TRUE if the color is one of the colors that the user selected in the slicer and FALSE if the user did not select the color. Like below:

IDColorMyMeasure

1

redTRUE

2

greenFALSE
3redTRUE
4redTRUE
5blueFALSE
6yellowTRUE

 

I have tried using the IN operator. For example, MyMeasure = MyTable[Color] IN VALUES(AllColors[Color]), but that does not seem to work at the rowwise level (like functions such as SUMX, AVERAGEX, etc might work).

 

Is it possible to create a measure like I want? Thank you!

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @tt211595  - Create a table that contains all unique colors

uniquecolors = VALUES('MyTable'[Color])

create a measure and pass your uniquecolors :

MyMeasure =
VAR SelectedColors = VALUES('AllColors'[Color])
RETURN
IF(
SELECTEDVALUE('MyTable'[Color]) IN SelectedColors,
TRUE,
FALSE
)

 

Ensures that the measure MyMeasure evaluates each row of MyTable and returns TRUE if the color is selected in the slicer otherwise FALSE

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
connect
Resolver I
Resolver I

Please use the following measure: 

MyMeasure =
VAR SelectedColors = VALUES('AllColors'[Color])
RETURN
IF (
COUNTROWS (
FILTER (
SelectedColors,
SelectedColors =MyTable[Color]
)
) > 0,
TRUE,
FALSE
)

rajendraongole1
Super User
Super User

Hi @tt211595  - Create a table that contains all unique colors

uniquecolors = VALUES('MyTable'[Color])

create a measure and pass your uniquecolors :

MyMeasure =
VAR SelectedColors = VALUES('AllColors'[Color])
RETURN
IF(
SELECTEDVALUE('MyTable'[Color]) IN SelectedColors,
TRUE,
FALSE
)

 

Ensures that the measure MyMeasure evaluates each row of MyTable and returns TRUE if the color is selected in the slicer otherwise FALSE

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





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.

Top Solution Authors