Forum Discussion
djo_ops
7 years agoRegular Visitor
DAX Expression Help
I'm trying to write a nested if DAX statement where one piece may have one or more logical tests. For whatever reason, the statement won't produce the result in quotations which is the STATUS after i...
- 7 years ago
Try using my SWITCH statment.
Or you have to modify your IF statement to only have 4 if statements.
I'm not going to redo the whole thing, but look at the first two parts here:
Status = IF ( ORDHDR00_ORDDTL00[Cons. B/O Flag] = "Y", "CONS. B/O", IF ( ORDHDR00_ORDDTL00[Pick Date Dec] = 0 && ORDHDR00_ORDDTL00[Released Date Dec] = 0 && ORDHDR00_ORDDTL00[Shipped Date Dec] = 0 && ORDHDR00_ORDDTL00[B/O Flag] <> "B" && ORDHDR00_ORDDTL00[Detail Future Flag] <> "F" && ORDHDR00_ORDDTL00[Order Status] = "" && ORDHDR00_ORDDTL00[Held Status] = "N" && "OPEN", IF ( ORDHDR00_ORDDTL00[Pick Date Dec] <> 0, IF ( ORDHDR00_ORDDTL00[Ack. Pick Date Dec] = 0, IF ( ORDHDR00_ORDDTL00[Released Date Dec] = 0, IF ( ORDHDR00_ORDDTL00[Shipped Date Dec] = 0, "RLS.PICK", IF ( ORDHDR00_ORDDTL00[Pick Date Dec] <> 0, IF ( ORDHDR00_ORDDTL00[Ack. Pick Date Dec] <> 0, IF ( ORDHDR00_ORDDTL00[Released Date Dec] = 0, IF ( ORDHDR00_ORDDTL00[Shipped Date Dec] = 0, "ACK. PICK", BLANK () ) ) ) ) ) ) ) ) ) )SO you need lots of "ands" which is && in DAX, not lots of IF statements.
edhans
7 years agoCommunity Champion
Great djo_ops . Glad we got it figured out. By the way, one of the things that really helped me was seeing the DAX formatted. It brings things out you might not otherwise see. After building your formulas, paste them to DAXFORMATTER. It will format them for you! I keep one tab in my browser on that page all day long.