Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
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]))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |