IMLOG10

Super User
674 Views
Greg_Deckler
Super User
Super User

IMLOG10

In my recent quest to create or catalog as many DAX equivalents for Excel functions, was able to leverage COMPLEXIMAGINARY and IMREAL into IMLOG10.

 

IMLOG10 = 
    VAR __Real1 = [IMREAL]
    VAR __i1 = [IMAGINARY]
    VAR __Real = LOG(EXP(1),10) * LN( SQRT( POWER(__Real1,2) + POWER(__i1,2) ) )
    VAR __i = LOG(EXP(1),10) * ATAN(DIVIDE(__i1,__Real1,0))
    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
    )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
avatar user