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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
chotu27
Post Patron
Post Patron

Muliple if Condition with multiple conditions

Hi All,

 

@Ignatkovkir 

 

Below is the sample data

Column 1       Column2

EMEN -OTTOLX
EIN -OTTOLX
EMEN -OTTOIA
ANIN -OTTTRS
EMEN -OTTBHT
EMEN -OTTSTA
EMEN -OTTSTI
ABIN-OTTOLX
BCID-OTTOIA
CFTU-OTTOIA

 

Now i want a Dax column or conditional column such that 

if(table(colum2) = OLX || TRS   and   if(table(colum2) = OIA||BHT and  if(table(colum1) = Start with "EMEN" then it should show "State coverd" and  if(table(colum2)= STA||STI then "Current State" and rest all  "not covered"

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @chotu27 

 

Based on your description, you may try the following formulas.

 

formula1 = 
IF(
    OR('Table'[Column2]="OLX",'Table'[Column2]="TRS")&&
    LEFT('Table'[Column1],4)="EMEN",
    "State Covered",
    IF(
        OR('Table'[Column2]="OIA",'Table'[Column2]="BHT")&&
        LEFT('Table'[Column1],4)="EMEN",
        "State Covered",
        IF(
            OR('Table'[Column2]="STA",'Table'[Column2]="STI"),
            "Current State",
            "not covered"
        )
    )
)
formula2 = 
SWITCH(
    TRUE(),
    OR('Table'[Column2]="OLX",'Table'[Column2]="TRS")&&LEFT('Table'[Column1],4)="EMEN","State Covered",
    OR('Table'[Column2]="OIA",'Table'[Column2]="BHT")&&LEFT('Table'[Column1],4)="EMEN","State Covered",
    OR('Table'[Column2]="STA",'Table'[Column2]="STI"),"Current State",
    "not covered"
)

 

 

Result:

a1.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @chotu27 

 

Based on your description, you may try the following formulas.

 

formula1 = 
IF(
    OR('Table'[Column2]="OLX",'Table'[Column2]="TRS")&&
    LEFT('Table'[Column1],4)="EMEN",
    "State Covered",
    IF(
        OR('Table'[Column2]="OIA",'Table'[Column2]="BHT")&&
        LEFT('Table'[Column1],4)="EMEN",
        "State Covered",
        IF(
            OR('Table'[Column2]="STA",'Table'[Column2]="STI"),
            "Current State",
            "not covered"
        )
    )
)
formula2 = 
SWITCH(
    TRUE(),
    OR('Table'[Column2]="OLX",'Table'[Column2]="TRS")&&LEFT('Table'[Column1],4)="EMEN","State Covered",
    OR('Table'[Column2]="OIA",'Table'[Column2]="BHT")&&LEFT('Table'[Column1],4)="EMEN","State Covered",
    OR('Table'[Column2]="STA",'Table'[Column2]="STI"),"Current State",
    "not covered"
)

 

 

Result:

a1.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

I doubt on few and condition, but you can get like

 

if(table(colum2) in {"OLX", "TRS"} && table(colum2) =  in {"OIA", "BHT"} &&  search("EMEN",table(colum1),1) >0 , "State coverd" 
, if(table(colum2) in {"STA","STI"} , "Current State" ,  "not covered"))


if(table(colum2) in {"OLX", "TRS","OIA", "BHT"} &&  search("EMEN",table(colum1),1) >0 , "State coverd" 
, if(table(colum2) in {"STA","STI"} , "Current State" ,  "not covered"))

 

Or use use Switch True

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

You might need to make some adjustments, but a column with a switch statement should do the job.

 

ColumnName = switch(
true();
if(or(table[column2]="OLX";table[column2]="TRS");"State Covered";blank());
if(or(table[column2]="OIA";table[column2]="BHT");"State Covered";blank());
if(left(table[column1];4)="OMEN";"State Covered";blank());
if(or(table[column2]="STA";table[column2]="STI";"Current State";blank());
"Not covered")

when colum1 of "OIA" and "BHT " along with column2 of starts with "EMEN" then also it should be "State Covered"

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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