Calculate total revenue using Custom Column in Power BI
Вставка
- Опубліковано 24 січ 2025
- Through this video , we will learn how to calculate total revenue before applying discount and after applying discount in Power BI and there are high chances that you may be given this type of scenario in an interview because businesses often want to find out the total revenue generated before applying discount and total revenue generated after applying discount . Through this , they can then study the impact of discounts on sales and that may also affect business strategies especially sales and marketing strategies .
Ok here are the steps of how to do the calculation
Steps to Create Custom Columns:
Open Power Query Editor:
In Power BI Desktop, go to the Home tab and click on Transform data.
Add a Custom Column:
In the Power Query Editor, go to the Add Column tab and select Custom Column.
Define the Custom Column Formula:
In the Custom Column dialog box, enter the name of your new column and the formula.
Example Formulas:
Total revenue before Discount:
[Units] * [Unit Price]
This formula multiplies the values in the Units column by the values in the Unit Price column.
Total revenue after Discount:
[Total Sale before Discount] * (1 - [Discount])
This formula applies the discount to the Total Sale before Discount.
After creating custom columns , for converting the data type usually you do not see the data type named currency in Power query and so there is a workaround for this . Go to table view , click on the custom column , change the data type to whole number and then change the format to currency and this will eventually set the data type as currency