Forum Discussion

TimK's avatar
TimK
Helper III
4 years ago
Solved

Problem with getting totals

I am sure there is a very easy answer to this!

 

Basically i have a table like this (simplified for here)

ProjL/MDDDateCoefficient
AMBuild01/05/20280
AMBuild01/06/20280.00784261
AMBuild01/07/20280.0680792
AMBuild01/08/20280.23133047
AMBuild01/09/20280.50448799
AMBuild01/10/20280.71814098
AMBuild01/11/20280.91698592
AMBuild01/12/20281.04398334
AMBuild01/01/20291.07310363
AMBuild01/02/20290.91556296
AMBuild01/03/20290.51749098
AMBuild01/04/20290.00299192
AMBuild01/05/20290
AMBuild01/06/20290
AMBuild01/07/20290
BMBuild01/05/20280
BMBuild01/06/20280.0039213
BMBuild01/07/20280.0340396
BMBuild01/08/20280.11566524
BMBuild01/09/20280.25224399
BMBuild01/10/20280.35907049
BMBuild01/11/20280.45849296
BMBuild01/12/20280.52199167
BMBuild01/01/20290.53655181
BMBuild01/02/20290.45778148
BMBuild01/03/20290.25874549
BMBuild01/04/20290.00149596
BMBuild01/05/20290
BMBuild01/06/20290
BMBuild01/07/20290

 

Basically what i need to do is normalise the data in the [Coefficient] column based on the columns [Proj], [L/M] and [DD]

So basically i am after a new column, with the value of [Coefficient] divided by the total of all the [Coefficients] for that specific grouping of [Proj], [L/M] and [DD]

So the total of all the [Coefficients] for [A], [M] and [Build] is 6

So for each line i need for example

0.00784261] / 6 = 0.0013071

0.0680792 / 6 =0.011346

 

etc

 

Any help welcomed

  • TimK,

     

    Try this calculated column:

     

    New Column = 
    VAR vNumerator = Table1[Coefficient]
    VAR vDenominator =
        CALCULATE (
            SUM ( Table1[Coefficient] ),
            ALLEXCEPT ( Table1, Table1[Proj], Table1[L/M], Table1[DD] )
        )
    VAR vResult =
        DIVIDE ( vNumerator, vDenominator )
    RETURN
        vResult

     

     

1 Reply

  • TimK,

     

    Try this calculated column:

     

    New Column = 
    VAR vNumerator = Table1[Coefficient]
    VAR vDenominator =
        CALCULATE (
            SUM ( Table1[Coefficient] ),
            ALLEXCEPT ( Table1, Table1[Proj], Table1[L/M], Table1[DD] )
        )
    VAR vResult =
        DIVIDE ( vNumerator, vDenominator )
    RETURN
        vResult