Forum Discussion

Marcox28's avatar
Marcox28
Icon for Helper II rankHelper II
4 years ago
Solved

convert excel formula to DAX

How can i convert this formula excel in dax ?   =IF(ISNUMBER(SEARCH("TEST";S549));"N/A";IF(AND(D549<>"DELETE";D549<>"TRUE";D549<>"REJECTED";L549="1 – TOP";OR(R549="DRAFT";R549="TO APPROVE";R549="TO...
  • danextian's avatar
    4 years ago

    Hi Marcox28 

    Without a sample pbix, it is hard to come up with a correct formula. Assuming the formula is for a calculated column, here is my conversion to DAX:

    FORMULA = 
    SWITCH (
        TRUE (),
        CONTAINSSTRING ( 'Table'[Column S], "TEST" ), "N/A",
        NOT 'Table'[Column D]
            IN { "DELETE", "TRUE", "REJECTED" }
                && 'Table'[Column L] = "1 - TOP"
                && 'Table'[Column R]
                    IN { "DRAFT", "TO APPROVE", "TO START" }
                        && 'Table'[Column AO] = 0
                        && 'Table'[Column BB] <= DATE ( 2022, 1, 1 ), "ON",
        "OFF"
    )

    Note: SWITCH function is kind of a shorthand for multiple IF statements.