How to calculate profit when cost and revenue are in same column

0 votes

Goal: Calculate profit when cost and revenue are in the same column.

Sample Data-set:

 item   account_category   balance
   x                cost         5
   x                cost         5
   x             revenue        12
   y                cost         8
   y             revenue         7

Query: How to create a calculation that gives profit both in terms of absolute cost(i.e., revenue - cost) and percentage of revenue (i.e., (revenue - cost)/ revenue).

Apr 10, 2018 in Tableau by Atul
• 10,240 points
1,185 views

1 answer to this question.

0 votes

You can create the following calculated fields:

Profit:

SUM(IIF([account_category] = "revenue",[balance],NULL))
-
SUM(IIF([account_category] = "cost",[balance],NULL))

% of Revenue:

(
    SUM(IIF([account_category] = "revenue",[balance],NULL))
    -
    SUM(IIF([account_category] = "cost",[balance],NULL))
)
/
SUM(IIF([account_category] = "revenue",[balance],NULL))
answered Apr 10, 2018 by ffdfd
• 5,550 points

Related Questions In Tableau

0 votes
1 answer
0 votes
1 answer

How to select column which are needed to create report in tableau

Please follow this process: Make database connection Join tables Go ...READ MORE

answered Sep 27, 2018 in Tableau by AwesomeSauce
• 860 points
744 views
0 votes
1 answer

How to add a story with same sheet with different parameters and filters added in tableau?

Hi Riya, Follow these steps to add sheets/dashboard ...READ MORE

answered Mar 22, 2019 in Tableau by Cherukuri
• 33,030 points
3,579 views
0 votes
1 answer

How to show actual and forecast in same line chart?

Hi Sindhu, Follow the below steps: 1. Create a line ...READ MORE

answered May 23, 2019 in Tableau by Cherukuri
• 33,030 points
3,538 views
0 votes
1 answer

Calculated filed with if-then

Below is the required code:  IF (NOT ISNULL([test2])) ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
1,594 views
0 votes
1 answer

Creating a calculated field with LOD expression

Go ahead and try the following three ...READ MORE

answered Apr 20, 2018 in Tableau by ffdfd
• 5,550 points
1,172 views
0 votes
2 answers

Calculation issue: Distinct sum in Tableau

I feel the easiest way is to ...READ MORE

answered Aug 26, 2020 in Tableau by Dhiraj Kumar Sahu
9,595 views
0 votes
1 answer

Creating a calculated field for summing up the values

Well you can use this in your ...READ MORE

answered May 18, 2018 in Tableau by ffdfd
• 5,550 points
697 views
+2 votes
1 answer
0 votes
1 answer

How to calculate the percent of records within a group in tableau?

 You can click the measure SUM(Number of Records) and ...READ MORE

answered May 9, 2018 in Tableau by ffdfd
• 5,550 points
4,799 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP