Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (11.1k points)

How can I calculate the profit when the cost and revenueon the same column

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

 

1 Answer

0 votes
by (22.5k points)

Profit:

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

Percent of revenue:

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

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

enter image description here 

enter image description here

And follow the steps

 If you want to learn more about it Tableau, then go through this Tableau Training for more insights.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Dec 29, 2020 in BI by dev_sk2311 (45k points)

Browse Categories

...