Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

an argument of function power has the wrong data type or the solution is too ...

Hi there,  I run the following calculation and typically it works, for some days I've been receiving this message: "an argument of function power has the wrong data type or is too..." this is the ...
  • AlexisOlson's avatar
    4 years ago

    BTW, using variables and a SWITCH makes this kind of measure much easier to read.

     

    Try something like this:

    Output =
    VAR _X = SELECTEDVALUE ( 'Horizon'[X] )
    VAR _Qtr  = SUM ( '3m'[Y] ) / SUM ( Value[Y] )
    VAR _Year = SUM ( '12'[Y] ) / SUM ( Value[Y] )
    RETURN
        SWITCH (
            _X,
            "3m (annualized)",
                IF ( _Qtr ^ 4 = 0, 0, ( _Qtr ^ 4 - 1 ) * 100 ),
            "3m",
                IF ( _Qtr = 0, 0, ( _Qtr - 1 ) * 100 ),
            "12m",
                IF ( _Year = 0, 0, ( _Year - 1 ) * 100 )
        )
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous 

     

    Does AlexisOlson 's method help you resolve the issue? If does, please kindly Accept it as the solution. More people will benefit from it.

     

    Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

    Refer to:

    How to Get Your Question Answered Quickly - Microsoft Power BI Community

    How to provide sample data in the Power BI Forum - Microsoft Power BI Community

     

     

    Best Regards,
    Eyelyn Qin