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
Peter_23
Post Patron
Post Patron

IN operator

Hi there, I have a dude with this expression: IN , e.g. how many values its accepting? 

It's similar to SQL: You can specify up to 1000 expressions in expression_list.

 

One example:

 

 

EVALUATE
VAR ID_values = CALCULATEBLE (VALUES ( USER[ID] ), USER[COUNTRY] = "US" )

RETURN SWITCH ( TRUE, FACT[ID_USER] IN ID_values, TRUE() )

 

 

 

I mean if this tabler USER it contains 1M of record and filterint to US is 200K , is this possible to the IN operator support all records.

 

 

Thanks in advance.

1 ACCEPTED SOLUTION

Hey @Peter_23 

I initially confused the concepts 😅. EXISTS is a logical operator in SQL, used to check the existence of rows in a subquery. However, there is no direct EXISTS function in DAX.

In DAX, similar logic can be achieved by using functions like CALCULATE combined with COUNTROWS to check if specific conditions are met.


Here’s a cleaner version of your query:

EVALUATE
VAR MatchCheck =
CALCULATE(
COUNTROWS(USER),
USER[ID] = FACT[ID_USER],
USER[COUNTRY] = "US"
)

RETURN
SWITCH(
TRUE(),
MatchCheck > 0, TRUE(),
FALSE()
)


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



View solution in original post

5 REPLIES 5
marcelsmaglhaes
Super User
Super User

Hey @Peter_23 ,

The IN operator is a CONTAINSROW  function behind the scenes, and because of that, does not have a fixed limit.

However, performance depends on the size of the data model, relationships and available memory. In large models, IN could lead to performance issues if not optimized.

Maybe you can use a different approach :

EVALUATE
VAR MatchCheck =
EXISTS(
USER,
USER[ID] = FACT[ID_USER] && USER[COUNTRY] = "US"
)

RETURN
SWITCH(TRUE,
MatchCheck, TRUE(),
FALSE()
)

 

  • EXISTS checks if a combination of USER[ID] and USER[COUNTRY] exists for FACT[ID_USER].
  • Simpler and optimized for large datasets.

 

 


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



Oh, you're right! @marcelsmaglhaes 

 

Remarks

    Except syntax, the IN operator and CONTAINSROW function are functionally equivalent.

 

and what do you mean with "EXISTS" ? I guess command.. 🤔

Hey @Peter_23 

I initially confused the concepts 😅. EXISTS is a logical operator in SQL, used to check the existence of rows in a subquery. However, there is no direct EXISTS function in DAX.

In DAX, similar logic can be achieved by using functions like CALCULATE combined with COUNTROWS to check if specific conditions are met.


Here’s a cleaner version of your query:

EVALUATE
VAR MatchCheck =
CALCULATE(
COUNTROWS(USER),
USER[ID] = FACT[ID_USER],
USER[COUNTRY] = "US"
)

RETURN
SWITCH(
TRUE(),
MatchCheck > 0, TRUE(),
FALSE()
)


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



That's OK @marcelsmaglhaes  Don't worry be happy 😀

parry2k
Super User
Super User

@Peter_23 yes it will, are you running into any issue?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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