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
Syndicate_Admin
Administrator
Administrator

Mejorar el rendimiento de la Fórmula de Medida

Necesitaré su apoyo para mejorar el rendimiento de la siguiente fórmula de medida. Esto está tardando demasiado tiempo en ejecutarse.

RealEqHours = CALCULAR (
SUMX ( SelfService_Plan_DailyPlanHour, IF(SelfService_Plan_DailyPlanHour[DailyPlanStatusId]=1,0,
IF(SelfService_Plan_DailyPlanHour[DailyPlanStatusId]=2,SelfService_Plan_DailyPlanHour[ActualStdHours],
if(SelfService_Plan_DailyPlanHour[DailyPlanStatusId]=3,SelfService_Plan_DailyPlanHour[ApprovedStdHours],SelfService_Plan_DailyPlanHour[ApprovedStdHours]))))
FILTRO ( SelfService_Plan_DailyPlanHour,
SelfService_Plan_DailyPlanHour[IsActive_Hour]
&&SelfService_Plan_DailyPlanHour[IsLatest]
&&SelfService_Plan_DailyPlanHour[ResourceTypeDescription]="Equipo"
&& (SelfService_Plan_DailyPlanHour[DailyPlanStatusDescription]="Aprobado" || SelfService_Plan_DailyPlanHour[DailyPlanStatusDescription]="Esperando aprobación")
&& RELACIONADO(SelfService_Control_CostItem[Is_terminal])
&&SelfService_Plan_DailyPlanHour[ProjectId]=RELATED(SelfService_Core_Project[Project_id])
), USERELATIONSHIP(SelfService_Plan_DailyPlanHour[ProjectIdEquipDisplay], InEightProjEquipmentStagingTable[ProjectIdEquipmentDisplay]))

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

No @jesly_ajin,

Se pueden definir variables, he modificado Dax de esta forma, puede agregarlo a su archivo PBIX para ver el tiempo empleado:

ActualEqHours =
var _1=
SWITCH(
    TRUE(),
SelfService_Plan_DailyPlanHour[DailyPlanStatusId]=1,0,
SelfService_Plan_DailyPlanHour[DailyPlanStatusId]=2,SelfService_Plan_DailyPlanHour[ActualStdHours],
SelfService_Plan_DailyPlanHour[DailyPlanStatusId]=3,SelfService_Plan_DailyPlanHour[ApprovedStdHours],
SelfService_Plan_DailyPlanHour[ApprovedStdHours])

var _2=SUMX(SelfService_Plan_DailyPlanHour,_1)

return
CALCULATE ( _2,
FILTER ( SelfService_Plan_DailyPlanHour,
SelfService_Plan_DailyPlanHour[IsActive_Hour]
&& SelfService_Plan_DailyPlanHour[IsLatest]
&& SelfService_Plan_DailyPlanHour[ResourceTypeDescription]="Equipment"
&& (SelfService_Plan_DailyPlanHour[DailyPlanStatusDescription]="Approved" || SelfService_Plan_DailyPlanHour[DailyPlanStatusDescription]="Awaiting Approval")
&& RELATED(SelfService_Control_CostItem[Is_terminal])
&& SelfService_Plan_DailyPlanHour[ProjectId]=RELATED(SelfService_Core_Project[Project_id])
),USERELATIONSHIP(SelfService_Plan_DailyPlanHour[ProjectIdEquipDisplay], InEightProjEquipmentStagingTable[ProjectIdEquipmentDisplay]))

Aquí están los documentos relacionados de optimización de la función Dax, espero que sea útil para usted:

https://maqsoftware.com/expertise/powerbi/dax-best-practices

https://community.powerbi.com/t5/Desktop/DAX-optimization/td-p/946984

https://docs.microsoft.com/en-us/power-bi/guidance/power-bi-optimization

Saludos

Liu Yang

Si este post ayuda, entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

No @jesly_ajin,

Se pueden definir variables, he modificado Dax de esta forma, puede agregarlo a su archivo PBIX para ver el tiempo empleado:

ActualEqHours =
var _1=
SWITCH(
    TRUE(),
SelfService_Plan_DailyPlanHour[DailyPlanStatusId]=1,0,
SelfService_Plan_DailyPlanHour[DailyPlanStatusId]=2,SelfService_Plan_DailyPlanHour[ActualStdHours],
SelfService_Plan_DailyPlanHour[DailyPlanStatusId]=3,SelfService_Plan_DailyPlanHour[ApprovedStdHours],
SelfService_Plan_DailyPlanHour[ApprovedStdHours])

var _2=SUMX(SelfService_Plan_DailyPlanHour,_1)

return
CALCULATE ( _2,
FILTER ( SelfService_Plan_DailyPlanHour,
SelfService_Plan_DailyPlanHour[IsActive_Hour]
&& SelfService_Plan_DailyPlanHour[IsLatest]
&& SelfService_Plan_DailyPlanHour[ResourceTypeDescription]="Equipment"
&& (SelfService_Plan_DailyPlanHour[DailyPlanStatusDescription]="Approved" || SelfService_Plan_DailyPlanHour[DailyPlanStatusDescription]="Awaiting Approval")
&& RELATED(SelfService_Control_CostItem[Is_terminal])
&& SelfService_Plan_DailyPlanHour[ProjectId]=RELATED(SelfService_Core_Project[Project_id])
),USERELATIONSHIP(SelfService_Plan_DailyPlanHour[ProjectIdEquipDisplay], InEightProjEquipmentStagingTable[ProjectIdEquipmentDisplay]))

Aquí están los documentos relacionados de optimización de la función Dax, espero que sea útil para usted:

https://maqsoftware.com/expertise/powerbi/dax-best-practices

https://community.powerbi.com/t5/Desktop/DAX-optimization/td-p/946984

https://docs.microsoft.com/en-us/power-bi/guidance/power-bi-optimization

Saludos

Liu Yang

Si este post ayuda, entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

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.