Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1808576
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:16:42+00:00 2026-05-17T06:16:42+00:00

A wrong percentage has been applied to a field (TotalPercentageAmount) and I need to

  • 0

A wrong percentage has been applied to a field (TotalPercentageAmount) and I need to correct it.
Given 2 fields Amount and TotalPercentageAmount how can I calculate what percentage was applied?
I need to work out percentage applied to TotalPercentageAmount and UPDATE the column with correct percentage.

Little script I have created to mimin my scenario . Table created contains wrong TotalPercentageAmount!!!

        CREATE TABLE [dbo].[SalesReportTest](
            [Id] [int] NOT NULL,
            [Amount] [decimal](18, 4) NOT NULL,
            [TotalPercentageAmount] [decimal](18, 4) NOT NULL,
         CONSTRAINT [PK_SalesReportTest] PRIMARY KEY CLUSTERED 
        (
            [Id] ASC
        )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
        ) ON [PRIMARY]


        GO
        SET NOCOUNT ON;
        SET XACT_ABORT ON;
        GO

        BEGIN TRANSACTION;
        INSERT INTO [dbo].[SalesReportTest]([Id], [Amount], [TotalPercentageAmount])
        SELECT 1, 55.0000, 52.0300 UNION ALL
        SELECT 2, 440.0000, 416.2200 UNION ALL
        SELECT 3, 300.0000, 283.8000 UNION ALL
        SELECT 4, -55.0000, -52.0300 UNION ALL
        SELECT 5, 98.0000, 92.7000 UNION ALL
        SELECT 6, -10.0000, -9.4600
        COMMIT;
        RAISERROR (N'[dbo].[SalesReportTest]: Insert Batch: 1.....Done!', 10, 1) WITH NOWAIT;
        GO
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:16:43+00:00Added an answer on May 17, 2026 at 6:16 am

    You can try the following to determine the percentage used. However, it appears that there is some precision loss because the Amount column appears to be truncated. I also include a column that demonstrates the 5.72% calc in your sample data.

    SELECT *, 
        CAST ((Amount / TotalPercentageAmount - 1) * 100 AS DECIMAL (5, 2)) as Pct,
        CAST (TotalPercentageAmount * 1.0572 AS INT) Amt_Calc
    FROM [SalesReportTest]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can't seem to get this to work. The idea is to calculate the percentage
RANSAC algorithm has been widely used in the engineering field such as computer vision.
what wrong with this Query ??? i need this Query. UPDATE user_preferences SET user_preferences_value
I created a custom object that has a Bitmap field. I'm drawing several of
Can anyone see what I'm doing wrong. I create an animation, load it with
I m trying to calculate profit percentage and write the value to next input
I would like to calculate the color depending on a percentage value: float percentage
I understand that this question has likely been asked, but I don't understand the
I'm trying to get the tax rate (percentage, not currency) for a given postcode
Whats wrong wrong with this query please correct me on this syntactcally it's going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.