• Eric M Russell (8/24/2015)


    maxlezious (8/24/2015)


    Eric M Russell (8/24/2015)


    maxlezious (8/24/2015)


    Thanks for your reply!

    I currently have a job setup which runs the stored procedure every week and inserts the usage figures in a table. All i am looking for is a query which I can run and it will show me the percentage of usage increase since last week. Any ideas?

    You can leverage the LAG() function to link record(s) for each week to the prior week and calculate a percentage.

    https://msdn.microsoft.com/en-us/library/hh231256.aspx

    Thanks for your reply! Any example would be great help.

    The link to documentation for LAG() function that I provided above, it includes an example for linking each record to prior based on date column. You can figure out the additional percentage calculation; it's just dividing prior by current.

    I will give it a go thanks