Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

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 code: 

Output =
IF(ALLSELECTED('Horizon'[X])=="3m (annualized)",
IF((((CALCULATE(SUM(3m[Y])/SUM(Value[Y]))^(12/3))-1))==-1,0,(((CALCULATE(SUM(3m[Y])/SUM(Value[Y]))^(12/3))-1))*100),
IF(ALLSELECTED('Horizon'[X])=="3m",
if((((CALCULATE(SUM(3m[Y])/SUM(Value[X]))-1)))==-1,0,(((CALCULATE(SUM(3m[Y])/SUM(Value[Y]))-1)*100))),
IF(ALLSELECTED('Horizon'[X])=="12m",
if((((CALCULATE(SUM(12[Y])/SUM(Value[Y]))-1)))==-1,0,(((CALCULATE(SUM(12[Y])/SUM(Value[Y]))-1)*100))),
"ERROR")))
2 ACCEPTED SOLUTIONS
AlexisOlson
Super User
Super User

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 )
    )

View solution in original post

Anonymous
Not applicable

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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

AlexisOlson
Super User
Super User

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 )
    )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors