Forum Discussion
DAX FUNCTION
I have a formula from excel and it really works and produces the output needed. However I need to convert this formula into Dax and use it in PowerBI. I have tried both || and && and its still not working: Here is the excel formula==>
=IF(OR(AND(OBJECT="6265",VALUE(ORG)<“699”),OBJECT="6255",AND(OBJECT="6256",VALUE(ORG)<“699”),OBJECT="6257",OBJECT="6258",OBJECT="6259",OBJECT="8911",AND(OBJECT="6112",VALUE(ORG)<“699”),AND(SUB_OBJECT="XH",VALUE(ORG)<>“816”),SUB_OBJECT="LQ",AND(SUB_OBJECT="DF",VALUE(ORG)<>”961”),AND(SUB_OBJECT="TE",VALUE(ORG)<>“816”),AND(SUB_OBJECT="JF",VALUE(ORG)<“699”),AND(SUB_OBJECT="JP",VALUE(ORG)<“699”),AND(SUB_OBJECT="CM",VALUE(ORG)<>“816”),AND(SUB_OBJECT="48",VALUE(ORG)<>“969”),OBJECT="6116",OBJECT="6119",OBJECT="6129",OBJECT="6141",OBJECT="6142",OBJECT="6143",OBJECT="6145",OBJECT="6146",OBJECT="6149",OBJECT="6144",OBJECT="6113",OBJECT="6126",VALUE(ORG)>“983”,AND(FUNCTION="12",VALUE(ORG)<“699”)),"NON","CON")
Note - All the the numbers here are text formats.
Thanks.
Hi Anonymous,
You use the VALUE function, which converts a text string that represents a number to a number. For example, VALUE("3") returns number 3. What's the type of ORG column? It is text like "32", then VALUE(ORG) returns number type, which is nou used to compare with text type, like VALUE(ORG)<“699”. Mybe you can change it to VALUE(ORG)<VALUE(“699”), and also mix corresponding arguments in Anonymous posted formula using similar way. Please try and check if it work fine.
Best Regards,
Angelia- Anonymous9 years ago
You need to indent and format your code so you can read it. You have the wrong number of parentheses in the wrong places.
12 Replies
- AnonymousNot applicable
Is this a column or a measure? Is Object a column? Org? Function? What exactly do you mean "it's not working"? What output are you getting? What output are you expecting?
- AnonymousNot applicable
Sorry these are all columns (object, org, function, sub_object). I m trying to create a now column from that formula. It create a new column in excel perfectly but not in PowerBI or DAX
- AnonymousNot applicable
Your first OR function seems to have about a dozen arguments when it is supposed to only have 2, so I assume you're just getting an error message?