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
Aydeedglz
Helper V
Helper V

IF with multiple conditions

Hi everyone, I am trying to create an if statement where I have multiple conditions, but I don't know how to use it

 

Measure =
SWITCH(
    TRUE(),
    CALCULATETABLE(TBL,TBL[C] = "\N" && TBL[C] = "2" && TBL[C] = " " && TBL[C] = "AL" && TBL[C] = "A" && TBL[C] = "AS" && TBL[C] = "CS" && TBL[C] = "EDS" && TBL[C] = "HQ", "OK", "New Value"))
 
I want if the column has any if this values then is ok if it has somehting different is a new valie
3 REPLIES 3
lbendlin
Super User
Super User

The colloquial "I need AL and AS and A and CS" translates into an OR statement  (otherwise nothing would be returned).

 

Instead of multiple ORs you can use IN and enumerate a list.

 

Measure = IF(TBL[C] IN { "\N","2"," ","AL","A","AS","CS","EDS","HQ"}, "OK", "New Value")

Hi, in the case of "C" in the table is not a measure, should I add a "Calculate" before? 

 

Measure = IF(Calculate(Sum(TBL[C] IN { "\N","2"," ","AL","A","AS","CS","EDS","HQ"}, "OK", "New Value")))

 

Or how can I bring the column of the table? 

You cannot sum text values.  Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.