Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
shahidalaila23
Frequent Visitor

how to calculate %

Hi 

I'm trying to calculate for % of total margin, 

below is sample of data set:

shahidalaila23_0-1620203660385.png

base of the table, the total of percent is 7.44%, however when I do manual calculation from the raw file, it show 66%

when I check again, the total appear as average. 

shahidalaila23_1-1620203814457.png

 

this is the formula I use to calculate margin : 

profit margin = SUM('MAIN DATA TABLE'[profit_last]) / SUM('MAIN DATA TABLE'[nett_sales]) 
then change the format to percentage to get % 
 
please help, is there other way to calculate % 

 

 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @shahidalaila23 

you may take steps below for reference.

1. Create a column:

v-xiaotang_0-1620373709584.png

Col_divide = 'MAIN DATA TABLE'[profit_last] /'MAIN DATA TABLE'[nett_sales]

2. Then create the measure:

Margin =
IF (
    HASONEVALUE ( 'MAIN DATA TABLE'[profit_last] ),
    SELECTEDVALUE ( 'MAIN DATA TABLE'[Col_divide] ),
    SUM ( 'MAIN DATA TABLE'[Col_divide] )
)

Result

v-xiaotang_1-1620373709587.png

Hope this helps.

 

Best Regards,

Community Support Team _ Tang

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

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @shahidalaila23 

you may take steps below for reference.

1. Create a column:

v-xiaotang_0-1620373709584.png

Col_divide = 'MAIN DATA TABLE'[profit_last] /'MAIN DATA TABLE'[nett_sales]

2. Then create the measure:

Margin =
IF (
    HASONEVALUE ( 'MAIN DATA TABLE'[profit_last] ),
    SELECTEDVALUE ( 'MAIN DATA TABLE'[Col_divide] ),
    SUM ( 'MAIN DATA TABLE'[Col_divide] )
)

Result

v-xiaotang_1-1620373709587.png

Hope this helps.

 

Best Regards,

Community Support Team _ Tang

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

amitchandak
Super User
Super User

@shahidalaila23 , Mark as % is needed

try like

profit margin = divide( SUM('MAIN DATA TABLE'[profit_last]) ,  SUM('MAIN DATA TABLE'[nett_sales]) )

 

or

without %

profit margin = divide( SUM('MAIN DATA TABLE'[profit_last]) ,  SUM('MAIN DATA TABLE'[nett_sales]) )*100

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors