Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
In my recent quest to create or catalog as many DAX equivalents for Excel functions, this one is analogous to IMAGINARY.
IMREAL =
VAR __Complex = [COMPLEX]
RETURN
SWITCH(TRUE(),
__Complex = "i" || __Complex = "j" || __Complex = "-i" || __Complex = "-j",0, // handle i/j -i/-j
FIND("i",__Complex,,-1) = -1 && FIND("j",__Complex,,-1) = -1,__Complex + 0, // handle only real numbers
FIND("+",__Complex,,-1) <> -1,LEFT(__Complex,FIND("+",__Complex)-1) + 0, // handle positive i
FIND("-",__Complex,2,-1) <> -1,LEFT(__Complex,FIND("-",__Complex,2)-1) + 0, // handle both negative real and negative i
0 // handle just negative i
)
This seems like a very self affirmational function name...
eyJrIjoiMGQ2YTQwOTEtZjM4MS00ODkxLThiYzUtOTg4NDVkYTk4ODcwIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9