Greg_Deckler's avatar
Greg_Deckler
Community Champion
6 years ago

IMCONJUGATE

In my recent quest to create or catalog as many DAX equivalents for Excel functions, was able to build upon my work with IMAGINARY and IMREAL to get this one:

 

IMCONJUGATE = 
    VAR __Complex = [COMPLEX]
RETURN
    SWITCH(TRUE(),
        __Complex = "i","-i",
        __Complex = "j","-j",
        __Complex = "-i","i",
        __Complex = "-j","j",
        FIND("i",__Complex,,-1) = -1 && FIND("j",__Complex,,-1) = -1,__Complex & "", // handle only real numbers
        FIND("+",__Complex,,-1) <> -1,SUBSTITUTE(__Complex,"+","-"), // handle positive i
        FIND("-",__Complex,2,-1) <> -1,SUBSTITUTE(__Complex,"-","+",2), // handle both negative real and negative i
        SUBSTITUTE(__Complex,"-","") // handle just negative i
    )

 

The real question in my mind though is, why; if there is a loving God, does that image exist? I mean, some things you just can't unsee. I've heard my son talk about cursed images and I believe this qualifies...

No RepliesBe the first to reply