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

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.

Reply
Anonymous
Not applicable

Si agregación de declaraciones

Hola

Escribí una medida para calcular los costos del trabajo utilizando diferentes métodos de contabilidad basados en la inteligencia del tiempo. Mi código de ejemplo es el siguiente:

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
        
Esto funciona en el nivel de la entidad, pero cuando se agrega a una agrupación superior, la medida no parece saber cómo iterar entre activos secundarios con distintos campos de fecha (es decir, RigReleaseDate). A continuación se muestra un objeto visual de matriz de ejemplo que utiliza la medida. Tengo curiosidad de cómo la medida está calculando 66 días entre CurrentDate y RigReleaseDate. Debe recorrer en iteración cada elemento secundario y ejecutar la instrucción IF en ese nivel para que la agregación funcione correctamente. Como puede ver, una agrupación puede tener varias filas secundarias con varias evaluaciones de instrucciones IF.
If Statement Aggregation.png
5 REPLIES 5
v-yiruan-msft
Community Support
Community Support

Hola @rstover ,

¿Podría proporcionar algunos datos de muestra y las fórmulas de medidas aplicadas en la medida"Costo final estimado"tal como sugiere @lbendlin para solucionar problemas? También proporcione los resultados correctos que deben mostrarse en visual.

Además, por favor intente crear una nueva medida como se muestra a continuación para reemplazar la medida"Coste final estimado"en el objeto visual y comprobar si puede devolver los valores correctos...

Measure = SUMX ( VALUES ( 'MDM WELL'[Formation] ), [Estimated Final Cost] )

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@yingyinr

Esa medida no proporcionó una respuesta diferente. Definitivamente parece que está evaluando la lógica de fecha utilizando el valor mínimo devuelto por los elementos secundarios.

Sin embargo, puedo intentar proporcionar algunos datos de muestra.

Hola @rstover ,

Gracias por su respuesta. ¿Podría proporcionar algunos datos de ejemplo para las siguientes tablas y las relaciones existentes entre ellas? Es mejor si puede proporcionar su archivo pbix de ejemplo (excluir datos confidenciales). Gracias.

vwSpotfire_CAPEX

Puente de Clasificación de Gastos

AFE_Budget_All

vwSpotfire_CAPEX_Estimated_Expense

MDM BIEN

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lbendlin
Super User
Super User

No está mostrando suficientes detalles. Las definiciones de

[Field Estimate Amount]
[AFE Amount]
[Adjusted Lateral Length]

puede o no afectar sus cálculos.

Anonymous
Not applicable

No hay problema

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]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.