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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ntravis
Frequent Visitor

Excel user sumif problem in DAX

I am having trouble with the CALCULATE function currently.  I am a heavy Excel user that is trying to transition into Power BI and DAX to further my analytical capabilities.   Given the two tables below, I am trying to calculate the total expected revenue for a job.

 

my current formula would be as follows:

 

Revenue = Calculate(

                             sum(Estimate[Amount])  +  sum(Adjustments[Amount]),

                                             Estimates[Type]="R",

                                             Adjustments[Type]="R")

 

This formulae works for the examples of job 1000 and 1002.  But, where job 1001 has no Adjustments, the formulae is just resulting in nothing.

 

I know how to tackle this in excel, but I am sure DAX can make this easier for me.   Please let me know your thoughts on how to correct this.

 

Thanks in Advance

 

Estimate
JobTypeAmount
1000E   15,000.00
1000R   20,000.00
1001E   25,000.00
1001R   30,000.00
1002E     7,500.00
1002R     1,000.00

 

 

Adjustments
JobTypeAmount
1000E      250.00
1000R      300.00
1000E      750.00
1000R      900.00
1002E   2,250.00
1002R   2,600.00
1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@ntravis This should work... Let me know...

 

Revenue =
CALCULATE ( SUM ( Estimate[Amount] ), Estimate[Type] = "R" )
    + CALCULATE ( SUM ( Adjustments[Amount] ), Adjustments[Type] = "R" )

 

Example2.png 

View solution in original post

5 REPLIES 5
waltheed
Impactful Individual
Impactful Individual

Hi ntravis,

 

I assume that you create a relationship between the two tables. The filter function is what it makes go wrong. it first filters both tables for R, and then sums it up. 

 

This should solve your issue:

Add a calculated column to the estimates table.

Use the LOOKUPVALUE function to find any related values in the adjustment table.

 

Calculated column: Adj

= LOOKUPVALUE(Adjustments[Amount]; Adjustments[Job]; Estimates[Job]; Adjustments[Type]; Estimates[type])

 

Then use a simple

Revenue: = Sum(Estimates[Amount]) + Sum(Estimates[Adj])

to get your result.

 

Another option would be to create an extra column, which is a combined key of Job and Type, in both tables and use that field to create a relationship. Then also a simple sum will work.

Cheers, Edgar Walther
ITsmart BI and Analytics consultant
Sean
Community Champion
Community Champion

@ntravis Are these 2 tables related in any way?

ntravis
Frequent Visitor

Hi Sean,

 

Yes sorry, both of these tables are transaction tables that are related though a "Job Master" table, where there is one to many relationship that is flows in both directions.

 

Capture.JPG

Sean
Community Champion
Community Champion

@ntravis This should work... Let me know...

 

Revenue =
CALCULATE ( SUM ( Estimate[Amount] ), Estimate[Type] = "R" )
    + CALCULATE ( SUM ( Adjustments[Amount] ), Adjustments[Type] = "R" )

 

Example2.png 

ntravis
Frequent Visitor

Thanks Sean!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.