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

Nested OR function and separate question on HTML for this forum

Part 1: the formula

 

We are trying to use a nested OR function for a calculated column to say:

If UserC is blank, OR if the ID is "", OR the ID is "none", OR the ID is a specific string, then it's Option 1, otherwise it's Option 2.

 

So far we have made this

 

Condition Met = IF(OR (UserC= "" ,

OR(ID = "",

OR(ID == "none", ID == "specific string"))),

"Option 1", "Option 2")

 

Issue is we're still capturing items that don't have a blank ID as Option 1, rather than 2, but it's quite random.

I'm assuming we've nested the formula wrong, am I missing anyhing?

 

Part 2: HTML formatting issue

 

this is a bit of a random one and pertains to this forum, but as I couldn't find a dedicated forum support, I might just ask here.

 

If I use "Increase Indent", as with the above problem, or create a table within this text box, and press Post, I always get the following error:

 

Your post has been changed because invalid HTML was found in the message body. The invalid HTML has been removed. Please review the message and submit the message when you are satisfied.

 

The irony is I'm only using the text editor right here on the forums, not even copying anything from an Word/Notepad file. Does anyone know what could be causing it?

1 ACCEPTED SOLUTION
SevsBo
Helper V
Helper V

I'm happy to close this one off. The issue wasn't with the formula but with the logic.... This is the correct way of doing what we wanted to do:

 

Condition Met = IF(AND (UserC = "" , OR(ID = "", OR(ID = "none", ID = "specific string"))), "Option 1", "Option 2")

 

In essence UserC has to be blank and then the other criteria come into play. We were using OR on all of them.

View solution in original post

4 REPLIES 4
SevsBo
Helper V
Helper V

I'm happy to close this one off. The issue wasn't with the formula but with the logic.... This is the correct way of doing what we wanted to do:

 

Condition Met = IF(AND (UserC = "" , OR(ID = "", OR(ID = "none", ID = "specific string"))), "Option 1", "Option 2")

 

In essence UserC has to be blank and then the other criteria come into play. We were using OR on all of them.

rubayatyasmin
Super User
Super User

Hi, @SevsBo 

 

Your original DAX formula looks good in structure, but in DAX the equality operator is single equals sign (=), not double (==). The double equals sign (==) is used in languages like JavaScript, Python, and C++.

 

However, the issue is that OR function in DAX can take only 2 arguments. Thus, your nested OR is incorrect. Instead, you should use multiple ORs, like this:

 

 

Condition Met = IF( OR (UserC = BLANK(), OR(ID = BLANK(), OR(ID = "none", ID = "specific string"))), "Option 1", "Option 2")

 

 

 

As for Part 2: 

 

If you just google and see for HTML syntaxes it actually uses <Tag Open> text or para </tagClose> some other syntaxes as well. So when we use something that conflicts with the editor's backend code it shows us the error. to paste code you can use the "Insert / Edit code sample". 

tabtab2
valval

 

Just tried creating this table, shows the same error. but it eventually works. It just removed the vertical line. 


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Hi @rubayatyasmin 

 

Firstly, thank you for confirming the issue with the forum - good to see I'm not the only one who has these issues!

 

As for the DAX, your formula appears to be identical to mine, apart from the == and using BLANK () instead of "".

 

Here are the two, side by side, if I take out my double == and change your BLANK () to "":

 

Condition Met = IF(OR (UserC = "" , OR(ID = "", OR(ID = "none", ID = "specific string"))), "Option 1", "Option 2")
Condition Met = IF(OR (UserC = "" , OR(ID = "", OR(ID = "none", ID = "specific string"))), "Option 1", "Option 2")

 

I have also tested it with your version, using BLANK() and it's the same result.

 

The == is called "Strict equal to", and is different that single = in that it considers blanks as equals as well. As per Microsoft.

Thank you for the info. Let me reconstruct it. 

Condition Met = IF(
OR (
ISBLANK(UserC),
OR(
ID == "",
OR(
ID == "none",
ID == "specific string"
)
)
),
"Option 1",
"Option 2"
)

 

make sure that you write none and specific string as it is saved in the data. it is case sensitive. 

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


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.