Forum Discussion

Snowy34's avatar
Snowy34
Helper III
7 years ago
Solved

Percentage difference between two columns

Good evening all, 

 

I'm trying to get percentage difference between two columns and I'm having some issues with it

 

my table is, (FYI the table code have duplicated skus)

 

Item             On Hand Bal       safety stock

PRI202W      100                     50

ABS123         50                       100

appreciate any help with this,

 

Regards 

Snowy

  • Hi,

    Try this measure

    =SUM([On Hand Bal])/((SUM([On Hand Bal])+SUM([safety stock]))/2)

6 Replies

  • tex628's avatar
    tex628
    Community Champion

    This very much depends on what you want to show. But generally speaking you would make a measure dividing the sum of one with the sum of the other.

    Measure = DIVIDE(SUM([On Hand Bal]) , SUM([safety stock]) , BLANK()) 

     

     

    • Snowy34's avatar
      Snowy34
      Helper III

      Good day Tax628

       

      The issue with this is it still is wrong,

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      As the first line % dif between 134 and 200 is 39.52%, not 67% I'm not sure where that 67% is getting pulled from.

       

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

        How did you calculate 39.52%  The numerator is 66.  What is the denominator?

  • Anonymous's avatar
    Anonymous
    Not applicable

    This might be helpful also to anyone looking for this.   I used variables (following along with the math provided by the same website the above poster referenced).   Everything matched up.   

    % Diff Pow vs Non Pow RMAs =
    VAR _absolutedifference =  [Power Sup count] - [Non Power Sup Count]
    VAR _averagebetween = ([Non Power Sup Count] + [Power Sup count] ) / 2
    VAR _percentdiff = (_absolutedifference / _averagebetween) * 1
    RETURN
    _percentdiff