Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello, what would be the best way to run both these in DAX within the same statement. Switch / nested? I can't quite work it through, grateful for pointers as a newbie.
Although only 2 conditions (at the moment), and looked at OR || as well, not sure on most appropriate method.
IF(CONTAINSSTRING(Table[CompanyNumber],"Company2"),IF(Table[Letter Received]="No" && ISBLANK(Table[Responded],
IF(Table[CompanyNumber]<>"Company2"),IF(Table[Letter Received]<>"No" && ISBLANK(Table[Responded]),
"Check",
"Pass"
)
Hi @JK-1 if you prefer to use nested if, please try this calculated column
Result =
IF (
Table[CompanyNumber] = "Company2",
IF (
Table[Letter Received] = "No" && ISBLANK(Table[Responded]),
"Check",
"Pass"
),
IF (
Table[Letter Received] <> "No" && ISBLANK(Table[Responded]),
"Check",
"Pass"
)
)
Hi @JK-1 ,
The best and most recommended way to write this logic in DAX is by using the SWITCH function.
This approach is cleaner, easier to read, and more scalable than nested IF statements, making it a best practice for handling multiple conditions. It evaluates each condition in order and returns the result for the first one that is true.
YourNewColumn =
SWITCH(
TRUE(),
CONTAINSSTRING(Table[CompanyNumber], "Company2") && Table[Letter Received] = "No" && ISBLANK(Table[Responded]), "Check",
Table[CompanyNumber] <> "Company2" && Table[Letter Received] <> "No" && ISBLANK(Table[Responded]), "Check",
"Pass" // This is the default result if no other condition is met
)
Best regards,
User | Count |
---|---|
17 | |
16 | |
14 | |
14 | |
13 |
User | Count |
---|---|
14 | |
12 | |
12 | |
8 | |
7 |