Forum Discussion

djo_ops's avatar
djo_ops
Regular Visitor
7 years ago
Solved

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...
  • edhans's avatar
    edhans
    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.