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! Learn more

Reply
Anonymous
Not applicable

Custom column: IF equals to one of multiple value

Hi,

 

As the title indicate, I am looking for solutions for creating a custom column using an IF statement based on whether the value of that column matches any values in the providing list.
In SQL, the query is something like:

 

SELECT count( case when column_a in (101, 133, 150, 168, 199, 323, 456, 888, 999) then 1 else 0)

 

The screenshot is a simplified approach to describe my question. Please advise how to approach this goal in adding custom column windows. Thank you in advance!

 

custom column.PNG

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Try usinig List.Contains like this instead.

 

= if List.Contains({30,40,50}, [age]) then 1 else 0

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

@mahoneypat gave a good M version of this.

 

If you happen to want to do this DAX instead, it would look like this:

IF ( [age] IN { 30, 40, 50 }, 1, 0 )

 

mahoneypat
Microsoft Employee
Microsoft Employee

Try usinig List.Contains like this instead.

 

= if List.Contains({30,40,50}, [age]) then 1 else 0

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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