# Multiple IF Statements

What is the appropriate to create a new column in the data that has multiple IF statements. Below is what I started but I think I am missing something. I am trying to use nested IF statements. I know how to do it when dealing with less than or equal to but in the case where its equal and there is no false I am new to that and likely over thinking it.

Based on the Academic Year in the Academic Year Column I am trying to sign a specific number, which is the Cost of Instruction.

In case anyone starts looking at this I am still playing with it I just need to get the ELSE syntax correct for DAX.

SOLVED! This is the formula I needed to use. Then after that I figured out that I could have just used a conditional column. I racked my brain for nothing!!!

`= Table.AddColumn(#"Reordered Columns2", "Instructional Cost", each if [Academic Year] = "2012-13" then 304 else if [Academic Year] = "2013-14" then 309 else if [Academic Year] = "2014-15" then 313 else if [Academic Year] = "2015-16" then 299 else if [Academic Year] = "2016-17" then 305 else if [Academic Year] = "2017-18" then 300 else 300)`

I would use SWITCH/ True() logic instead of nested ifs. Itâ€™s a better way to write this

See below

1 Like

Hi, quick questionâ€¦are you able to combine arguments with text and integers eg:
SWITCH( TRUE(
status = â€śQuoteâ€ť && probability >= 75, â€śHigh probability of winning quoteâ€ť
)

Figured it out! For anyone who is interested:

``````Current Status =
SWITCH (
TRUE (),
'Table'[SALESSTATUS] = "New" && 'Table'[SALES_STAGE] = "Design", "In Detailed Design",
'Table'[SALESSTATUS] = "New" && 'Table'[SALES_STAGE] = "", "In Design",
'Table'[SALESSTATUS] = "Quote" && 'Table'[PROBABILITY] < 75, "Quote - Possible To Win",
'Table'[SALESSTATUS] = "Quote" && 'Table'[PROBABILITY] >= 75, "Quote - Likely To Win",
'Table'[SALESSTATUS] = "In Progress" && 'Table'[SALES_STAGE] = "Won", "Won - Scheduled",
'Table'[SALESSTATUS] = "In Progress" && 'Table'[SALES_STAGE] = "Design", "Won - To Be Detailed",
'Table'[SALESSTATUS] = "In Progress" && 'Table'[SALES_STAGE] = "Quote", "Won - Waiting On Drawings",
"On Hold"
)``````

Nice one

1 Like

Would anyone happen to know how to do incorporate a â€śdoes not containâ€ť field in a Switch/True statement?

I would like to filter out any dashes (aka â€ś-â€ť) in a product string and this is the only piece I canâ€™t figure out.
How you can you write â€śdoes no contain dashesâ€ť in DAX language?

Try

CONTAINSSTRING(<within_text>, â€ś-â€ť) = FALSE

where within_text is the text to be evaluated.

• Brian

It worked! Thank you @BrianJ !

Similar questionâ€¦ but what if I want to use DAX to filter out the product nomenclature that â€śdoes not start with Râ€ť?

That gets me thinkingâ€¦Is there some type of resource where I can find all of the ways to to filter using advanced filtering that you can do by clicking in the report view of PowerBI, but using DAX expressions only?

(Does not contain, is not blank, is not, etc.)

For that one, youâ€™d use:

LEFT( text, 1) <> â€śRâ€ť

where text is the field you want to evaluate

My go-to resource for this type of thing is dax.guide

If you go there, and click on Groups, the two groups of functions youâ€™re looking for are â€śInformationâ€ť and â€śTextâ€ť.