Step # 1: Define your measures and columns
In this example, we will work with a subset of our Course Registration data model. Our goal will be to calculate the Profit for each Business Intelligence course we are currently delivering.
Here is our model:
We will focus on two columns in our model:
- Sales Amount (from the Orders table
- Cost (from the Courses table)
Step # 2: Calculate difference between Power BI columns
To get the difference between the two columns, we will create a measure.
- In the Report View, hit the Courses table.
- Then, from the Ribbon, hit the New Measure column.
- Then, in the formula row type the following DAX expression:
Profit = sum(Orders[Sales Amount])-Sum(Courses[Cost])
- Hit Enter.
- A new measure, named Profit, will be created. In case you have several measures, you might want to add those to a folder in your Model View.
Step # 3: Create your Power BI Report
Next step is to create a simple Report to display the Profit for each course.
- Back to the Report View, add a new page to your report.
- Then, from the Visualizations pane, pick a table visual.
- Then drag the following fields into the visual columns section: Course Name (from Courses), Sales Amount (from Orders), Cost (from Courses) and the newly created Profit measure (from Courses as well).
- Hit the column headers to sort the values in your visual.
- The following table will be shown:
Optionally, you can add a slicer and a card into your report to better visualize the Profit for specific courses.
In case of additional questions, feel free to reach out via the comments.