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, was able to leverage COMPLEX, IMAGINARY and IMREAL into IMPOWER.
IMPOWER =
VAR __Real1 = [IMREAL]
VAR __i1 = [IMAGINARY]
VAR __power = MAX('Table'[power])
VAR __r = POWER(SQRT(POWER(__Real1,2) + POWER(__i1,2)),__power)
VAR __theta = ATAN(__i1/__Real1)
VAR __Real = __r * COS(__power * __theta)
VAR __i = __r * SIN(__power * __theta)
VAR __suffix = IF(MAX([suffix])="","i",MAX([suffix]))
RETURN
SWITCH(TRUE(),
__Real = 0 && __i = 1, __suffix,
__Real = 0 && __i = -1, "-" & __suffix,
__Real = 0, __i & __suffix,
__i = 0, __Real & "",
__i < 0 && __i = -1, __Real & "-" & __suffix,
__i < 0, __Real & "-" & ABS(__i) & __suffix,
__i = 1, __Real & "+" & __suffix,
__Real & "+" & __i & __suffix
)
I can't decide if this function is affirmational or pretentious...
Credit for the graphic goes to my son Rocket, who I have commissioned to create images for my Quick Measure Gallery entries. Proud dad moment! 🙂
eyJrIjoiMzU2ZDYwZGEtMGUyYy00ODhjLThiZDYtNTQ2MDkxZTNkZDliIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9