Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
qwaszx55
Frequent Visitor

Newbie question: The simplest idea seems to be the most difficult.

I am trying to do some simple math and can't for the life of me figure out the correct formula to use.

 

I have one table that includes project number and revenue

 

I have another table that has multiple entries of project number and costs

 

I Just want a table that shows revenue, cost, and then profit (revenue - cost)

 

I'm using 

"Cost = SUMX(VALUES(JournalDetailView[PROJECTNO]),CALCULATE(SUM(JournalDetailView[Amounts])))"

To total the costs into a new measure called "COST". The revenue however is in a different table. 

 

So this will be a dumb question but how do I do Projects[Revenue} - JournalDetailView[COST]

 

Should I be shaping the data before hand to put it all together? 

1 ACCEPTED SOLUTION

Given the data you describe and an assumed 1-to-many relationship between Projects and DetailedJournalView create the following measures:

 

RevenueTotal = SUM(Projects[Revenue])

TotalAmount = SUM(JournalDetailView[Amounts])

Difference = [RevenueTotal] - [TotalAmount]

Create a visualization (table) with ProjectNO from the Projects table and these three measures. I get:

 

ProjectNORevenueTotalTotalAmountDifference
11073
215123
320515


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

Sample data and structure would be helpful, but the answer likely lies in creating measures for revenue and cost and then another measure that subtracts your cost measure from you revenue measure.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Table One (Projects)

 

ProjectNO | Revenue

1                |       $10

2                |       $15

3                |       $20

 

Table Two(JournalDetailView)

 

ProjectNO | Amounts

1                | $2

1                | $5

2                | $10

2                | $1

2                | $1

3                | $5 

 

 

Then doing:

"Cost = SUMX(VALUES(JournalDetailView[PROJECTNO]),CALCULATE(SUM(JournalDetailView[Amounts])))"

To total the costs for each project. The revenue however is in a different table. 

 

So:

"then another measure that subtracts your cost measure from you revenue measure."

 

Is where I'm stuck. Seems easy enough but the fact that they are in different tables seems to be stopping me.

 

Given the data you describe and an assumed 1-to-many relationship between Projects and DetailedJournalView create the following measures:

 

RevenueTotal = SUM(Projects[Revenue])

TotalAmount = SUM(JournalDetailView[Amounts])

Difference = [RevenueTotal] - [TotalAmount]

Create a visualization (table) with ProjectNO from the Projects table and these three measures. I get:

 

ProjectNORevenueTotalTotalAmountDifference
11073
215123
320515


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.