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,200 points
46 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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 Atul
• 5,470 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 26, 2018 in Tableau by AwesomeSauce
• 830 points
26 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 in Tableau by CHERUKURI
• 13,940 points
22 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 4 days ago in Tableau by CHERUKURI
• 13,940 points
13 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,200 points
36 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 Atul
• 5,470 points
58 views
0 votes
1 answer

Calculation issue: Distinct sum in Tableau

SUM( { FIXED [Brand], [Market]: AVG(Target) } ...READ MORE

answered May 8, 2018 in Tableau by Atul
• 10,200 points
1,574 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 17, 2018 in Tableau by Atul
• 5,470 points
28 views
+1 vote
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 8, 2018 in Tableau by Atul
• 5,470 points
67 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.