Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Sum of Divided Columns

Hi.

I have a table where I have 3 columns:
-A;
-B;
-C = A/B

And when I aggregate I need to sum the result of each row of column C instead the sum of column A divided by the sum of column B.

Is it possible to do this?





  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Make sure [C] is a calculated column with logic [A] / [B] in Power BI. Then you can aggregate it in visual like table by sum function in value field. If [C] is a measure, you need to sum the measure or create avirtual table to calculate [C] to get the result you want.

    Calculated column:

    C = DIVIDE( 'Table'[A],'Table'[B])

    Result is as below.

    Measure:

    C = 
    VAR _ADD = ADDCOLUMNS('Table',"C",DIVIDE([A],[B]))
    RETURN
    SUMX(_ADD,[C])

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Make sure [C] is a calculated column with logic [A] / [B] in Power BI. Then you can aggregate it in visual like table by sum function in value field. If [C] is a measure, you need to sum the measure or create avirtual table to calculate [C] to get the result you want.

    Calculated column:

    C = DIVIDE( 'Table'[A],'Table'[B])

    Result is as below.

    Measure:

    C = 
    VAR _ADD = ADDCOLUMNS('Table',"C",DIVIDE([A],[B]))
    RETURN
    SUMX(_ADD,[C])

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.