#MsSQLServer: Calculate Total Revenue by Brand

Welcome to this Microsoft SQL Server video tutorial, we will learn how to calculate Total Revenue by Brand. If you enjoy the video, like, comment, share and subscribe to the channel



In the caption below, we wrote a simple select all statement that returned all the columns from the specified table

Query to Retrieve Total Revenue by Brand

The following is the query that returns Total Revenue by Brand:

select brand, format(sum([Total Revenue]), ‘c’) as Total_Rev from [Sales Report] group by Brand

In the above query, we selected the brand column and aggregated the Total Revenue column which is formatted using the Currency specified in Regional Settings. In addition, the Total_Rev represent alias which is otherwise new custom column name. Then, we selected from the Sales Report Table under the Transaction_Data database and finally group by Brand

Click on Execute or F5 to run the query.

See you in the next tutorial

Posted in Blog.

Leave a Reply

Your email address will not be published. Required fields are marked *