Forum Discussion
Anonymous
4 years agoNot 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 ...
- 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 ) ) - Anonymous4 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
AlexisOlson
Super User
4 years agoBTW, 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 )
)