10 Replies Latest reply on Sep 10, 2018 3:47 PM by Hari Ankem

# Can't raise integer value to integer power

I'm trying to create a calculated field which takes a value and a date and discounts it to calculate net present costs. I've done this previously in Excel-linked workbooks using the equation [Value] * (1-i)^([Year] - 20##) where 20## is the discounting year (e.g. 2018). I'm trying to replicate this in a new workbook with an ODBC connection, but I'm getting errors like in the title. This occurs any time I try to include a field in an equation with exponents, such as 2^[Value] or [Year] ^ 3.2.

• ###### 1. Re: Can't raise integer value to integer power

Are you using the POWER function?

POWER(number, power)

• ###### 2. Re: Can't raise integer value to integer power

No, I am using the ^ notation. If I try to use POWER() I get the message "This function is not available on non-aggregates for this data source". I can get around it by using an extract instead of a live connection, but that's not ideal.

• ###### 4. Re: Can't raise integer value to integer power

That does not give the same equation. It would give, for example (A+B)^2, whereas I want A^2 + B^2

• ###### 5. Re: Can't raise integer value to integer power

Can you share your packaged workbook, with twbx extension, so that I can check it?

• ###### 6. Re: Can't raise integer value to integer power

Hi Jeff,

I want A^2 + B^2

Have you tried (sum([A])^2) + (sum([B])^2)

Note the bracketing. This will resolve differently to sum([A])^2 + sum([B])^2

HTH

Peter

• ###### 7. Re: Can't raise integer value to integer power

In this example A and B are rows of the same column, not individual columns.

• ###### 8. Re: Can't raise integer value to integer power

Unfortunately it contains a lot of privacy-sensitive information so I can't share it. I expect that packaging it would solve the issue anyway, since the error goes away if I work on a data extract instead of a live data connection.

• ###### 9. Re: Can't raise integer value to integer power

Hi Jeff - looks like you need to create some calculated fields to extract the information you want

A row

IF [A] = "insert text here" then [number of records or measure] END

B row

IF [B] = "insert text here" then [number of records or measure] end

Power calc

(sum([A row])^2) + (sum([B row])^2)

HTH

Peter

• ###### 10. Re: Can't raise integer value to integer power

Even though they are in the same column, you may be having a business logic to identify them as A and B. So, you should be able to create calculated fields to separate them and use.

Also, let us know what is your data source? Is it an Excel file or are you getting data from some database?