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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
abhishekjangid
Frequent Visitor

IN operator usage with Measure

Hi all,

I am working with IN operator and I have so many measure which have hardcoded values as of now.

I want to do something like this, I have a constant measure with a few whitelisted domains:
WhitelistedDomains = {"gmail.com", "yahoo.com"}

I want to create another measure which filters out only whitelisted domains rows from my table:
rows = Filter(emailTable, [emailColumn] IN [WhitelistedDomains])

Second measure does not work as expected. It throws an error that WhitelistedDomains is not a valid table.

 

What can be done here?

6 REPLIES 6
komald
Helper I
Helper I

@abhishekjangid ,You can try

Measure =
var lists = {"gmail.com", "yahoo.com"}
return
FILTER(EmailTable,EmailTable[Email] in lists)
Greg_Deckler
Community Champion
Community Champion

@abhishekjangid Yeah, unfortunately tha first measure is not valid because Microsoft doesn't allow you to return a non-scalar value for measures. So, for example, if you tried to use that first measure in a Card visual it would return an error. I really wish Microsoft would allow this. So, what you would need to do is to make your second measure this:

rows =
  VAR WhitelistedDomains = {"gmail.com", "yahoo.com"}
RETURN
  Filter(emailTable, [emailColumn] IN [WhitelistedDomains])

However, this will also not work due to the above explanation about returning non-scalar values so maybe something like this:

rows =
  VAR WhitelistedDomains = {"gmail.com", "yahoo.com"}
RETURN
  IF(MAX('emailTable'[emailColumn]) IN [WhitelistedDomains],1,0)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 
I could do this but WhitelistedDomains is something I am using in multiple measures. So i though to bring it out somewhere in common place.

If there is some other way I can do this.

@abhishekjangid Well, if it is hard-coded, then simply use that formula to create a Table instead. Then it will work just fine.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 
ahh, do not want a table. Because domains might change over time.

@abhishekjangid Yeah, again, I wish Microsoft allowed Measures to return tables. Would be so incredibly useful.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors