Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Calculation error with power operator

I am receiving the following error message when trying to perform a calculation in a measure which uses a power operator:

 

Error Message:
MdxScript(Model) (65, 142) Calculation error in measure 'TEST_DATA'[Measure 2]: An argument of function 'POWER' has the wrong data type or the result is too large or too small.

 

The Measure causing the issue is as follows:

                       Measure 2 = (1-((1-[Measure 1])^(0.5)))
 
where Measure 1 = (Measure A * Weight A) + (Measure B + Weight B)+....+(Measure F * Weight F)
and is a number between 0 and 1
 
All measures are displayed in Matrix with Account ID as the Row identifier. If I try and simplify Measure 2 to something like:
 
                                     Measure 2 = (1-((1-[Measure 1])*(0.5)))
 
then this calculates everything correctly, so the problem appears to be with the '^', I just can't figure out why.
 
Any help much appreciated.
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Gary I've managed to resolve this. I added in a 'divide by total weight' to Measure 1:

     

         Measure 1 = ((Measure A * Weight A) + (Measure B * Weight B)+....+(Measure F * Weight F)) / (Weight A + Weight B+.....+Weight F)

     

    No idea why it was causing problems not having that in.

5 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous Hmm, I can seem to replicate this but perhaps try:

    Measure 2 = 1 - POWER( 1-[Measure 1], 0.5)

    I was trying very small numbers like 0.00000001^(.5) and very large numbers, negative numbers, etc.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Still not working I'm afraid Greg

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Anonymous Perhaps put Measure 1 in some table visual and see if there is an odd value in there in some circumstance? I guess another way to put this, in what way are you using the measure, in a table or matrix or in a Card visual?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Just to add something, I've tried replacing 'Measure 1' in the calculation with 'Measure A' (which is just a column taken from my source data by using MAX, and it calculates without any issues. So for some reason it doesn't like Measure 1.

       

      Edit 1: The 'Weights' in Measure 1 are coming from Paramters (user selectable values between 0 and 1). If I hard code in set weights into Measure 1 then Measure 2 works.

       

      Edit 2: I've managed to resolve this, I added in a 'divide by total weight' to Measure 1:

       

           Measure 1 = ((Measure A * Weight A) + (Measure B + Weight B)+....+(Measure F * Weight F)) / (Weight A + Weight B+.....+Weight F)