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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Wrong calculation of percentage

Hi, I want to calculate the HST as % of sales, which simply requires a division in a new column. However, the calculation keeps showing an obvious wrong number. I would like to know what is going on here. 

Thank you in advance! the calculation is not correctthe calculation is not correct

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

The first time you use the calculated column, you are actually calculating ('Sales'[TaxRate1]/'Sales'[Product]) for each row of the sales table, and when you put it into the visualization, you actually get the sum of ('Sales'[TaxRate1]/'Sales'[Product]). What we actually want is the result of (SUM('Sales'[Taxrate1])/SUM('Sales'[Taxrate1])), which is different from the result of ('Sales'[TaxRate1]/'Sales'[Product]).

 

Have you tried Ashish_Mathur's method yet? He should be right, if his answer is helpful to you, please don't forget to mark his answer as a solution, it will help more people.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Write these measures (not calculated column formulas)

Products = sum(Sales[Product])

Tax rate = sum(Sales[Tax rate1])

HST as a % of sales = divide([Tax rate],[Products])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
tamerj1
Super User
Super User

Hi @Anonymous 

product and tax rate are columns or measures? If columns try to divide the SUM of each

Anonymous
Not applicable

it is column, I tried but still got the wield numbers with the total 64.86. it should be 10.68% if the calculation is correct. 😂

Hi @Anonymous ,

 

The first time you use the calculated column, you are actually calculating ('Sales'[TaxRate1]/'Sales'[Product]) for each row of the sales table, and when you put it into the visualization, you actually get the sum of ('Sales'[TaxRate1]/'Sales'[Product]). What we actually want is the result of (SUM('Sales'[Taxrate1])/SUM('Sales'[Taxrate1])), which is different from the result of ('Sales'[TaxRate1]/'Sales'[Product]).

 

Have you tried Ashish_Mathur's method yet? He should be right, if his answer is helpful to you, please don't forget to mark his answer as a solution, it will help more people.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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