Forum Discussion

AnandRanga's avatar
AnandRanga
Icon for Helper III rankHelper III
9 years ago
Solved

How to calculate % from a column?

this is my sample data and it is very simpleI have 2 columns a and b, then i created third column b/a, in percentage column i put the formula like this:

((value of b/a)/ sum of b/a column)*100

 

(28/420.31)*100 =6.66

the same thing i want to achieve in power BI. I am using quick calc functionality but that is showing 100% only for every record. Where i am doing wrong?

 Thanks for your time.

 

 

  • HI AnandRanga

     

    I took the first three columns of your sample data and created a table.

     

    I then added a calculated column as follows and formatted accordingly.

     

    b/a = DIVIDE(
    		'Table2'[a],
    		'Table2'[b]
    		)

    Then I added the following calculated measure

     

     

    Percentage = DIVIDE(
    			CALCULATE(
    				SUM('Table2'[b/a])
    				),
    				CALCULATE(
    					SUM('Table2'[b/a]),
    					ALL(table2)
    					)
    				)

    Which gave me the following

     

1 Reply

  • Phil_Seamark's avatar
    Phil_Seamark
    Icon for Microsoft Employee rankMicrosoft Employee

    HI AnandRanga

     

    I took the first three columns of your sample data and created a table.

     

    I then added a calculated column as follows and formatted accordingly.

     

    b/a = DIVIDE(
    		'Table2'[a],
    		'Table2'[b]
    		)

    Then I added the following calculated measure

     

     

    Percentage = DIVIDE(
    			CALCULATE(
    				SUM('Table2'[b/a])
    				),
    				CALCULATE(
    					SUM('Table2'[b/a]),
    					ALL(table2)
    					)
    				)

    Which gave me the following