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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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