Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I wrote a measure to calculate job costs utilizing different accounting methods based on time intelligence. My example code is below:
Estimated Final Cost = 
VAR CurrentDate = TODAY()
VAR RigReleaseDate = SELECTEDVALUE('MDM WELL'[RIG_RELEASE_DATE])
VAR FracEndDate = SELECTEDVALUE('MDM WELL'[FRAC_END_DATE])
VAR EstimatedFinalCost =
    IF( CurrentDate - RigReleaseDate > 180, [Accounting Actual],
        IF(OR(CurrentDate - RigReleaseDate <= 180, CurrentDate - FracEndDate <= 180), [Field Estimate Amount], [AFE Amount])
    )
VAR Result = EstimatedFinalCost / [Adjusted Lateral Length]
RETURN
    Result
        Hi @Anonymous ,
Could you please provide some sample data and the formulas of measures applied in measure "Estimated Final Cost" just as suggested by @lbendlin in order to make troubleshooting? Also please provide the correct results which should display on visual.
In addition, please try to create a new measure as below to replace the measure "Estimated Final Cost" on the visual and check if it can return the correct values...
Measure = SUMX ( VALUES ( 'MDM WELL'[Formation] ), [Estimated Final Cost] )Best Regards
Rena
@Anonymous
That measure didn't provide a different answer. It definitely looks like it is evaluating the date logic using the minimum returned valued from the children.
I can try and provide some sample data though.
Hi @Anonymous ,
Thanks for your reply. Could you please provide some sample data for the following tables and existed relationships among them? It is better if you can provide your sample pbix file(exclude sensitive data). Thank you.
vwSpotfire_CAPEX
Expense Classification Bridge
AFE_Budget_All
vwSpotfire_CAPEX_Estimated_Expense
MDM WELL
Best Regards
Rena
You are not showing enough details. The definitions of
[Field Estimate Amount]
[AFE Amount]
[Adjusted Lateral Length]may or may not impact your calculations.
No Problem
Accounting Actual =
CALCULATE (
    SUM ( vwSpotfire_CAPEX[SumAmount] ),
    USERELATIONSHIP ( vwSpotfire_CAPEX[CategoryName], 'Expense Classification Bridge'[CategoryName] )
)AFE Amount =
CALCULATE (
    SUM ( AFE_Budget_All[AFEBudget] ),
    USERELATIONSHIP ( AFE_Budget_All[CategoryName], 'Expense Classification Bridge'[CategoryName] )
)
Field Estimate Amount =
CALCULATE (
    SUM ( vwSpotfire_CAPEX_Estimated_Expense[EstimatedExpenses] ),
    USERELATIONSHIP ( vwSpotfire_CAPEX_Estimated_Expense[CategoryName], 'Expense Classification Bridge'[CategoryName] )
)Adjusted Lateral Length = CALCULATE(SUM('MDM WELL'[Lateral Length]))
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.