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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Possible to make less verbose DAX?

IF( 
    OR(Table[Column] = "A", 
    OR(Table[Column] ="B", 
Table[Column]="C")), "These are some letters", IF( OR(Table[Column]="Bill", OR(Table[Column]="Mary", OR(Table[Column]="Joe", OR(Table[Column]="Jeff",
Table[Column]="Tony")))),
"These are names","Other"
)

 

It just seems kinda crazy that I have to say Table[Column] every time, maybe "OR" isn't the best option. Is there a better way to write this?

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous,

 

In dax there isn't an equivalent formula to the IN of SQL, please check this article with the explanation and how to do it in different number of ways.

 

Regards,

MFelix

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
Vvelarde
Community Champion
Community Champion

@Anonymous

 

Hi, you can reduce the code using IN {}

 

Result =
SWITCH (
    TRUE (),
    Table1[Column] IN { "A", "B", "C" }, "These are some letters",
    Table1[Column] IN { "Bill", "Mary", "Joe", "Jeff", "Tony" }, "These are names",
    "Other"
)

Regards

 

Victor

Lima - Peru




Lima - Peru
MFelix
Super User
Super User

Hi @Anonymous,

 

In dax there isn't an equivalent formula to the IN of SQL, please check this article with the explanation and how to do it in different number of ways.

 

Regards,

MFelix

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.