Forum Discussion
Optimalize dax
- Anonymous3 years ago
HI Akos07,
I think they should be more related to your data amounts. The iterate calculation through two table with huge amount of records may cause the performance issues. (the total calculation amount= TableA row count * TabeB row count)
In addition, you can also try to use the following formulas if they help:
measure version:
CurrentDeliveryPriceGross = VAR currdate = MAX ( view_PBI_BTK_Sales[date] ) RETURN CALCULATE ( MAX ( view_PBI_BTK_Delivery[price] ), FILTER ( ALLSELECTED ( view_PBI_BTK_Delivery ), [date] <= currdate ), VALUES ( view_PBI_BTK_Sales[storeid] ), VALUES ( view_PBI_BTK_Sales[CikkCsomEgysegId] ) )Calculate column version:
CurrentDeliveryPriceGross = CALCULATE ( MAX ( view_PBI_BTK_Delivery[price] ), FILTER ( view_PBI_BTK_Delivery, [storeid] = EARLIER ( view_PBI_BTK_Sales[storeid] ) && CikkCsomEgysegId = EARLIER ( view_PBI_BTK_Sales[CikkCsomEgysegId] ) && [date] <= EARLIER ( view_PBI_BTK_Sales[date] ) ) )Regards,
Xiaoxin Sheng
HI Akos07,
I think they should be more related to your data amounts. The iterate calculation through two table with huge amount of records may cause the performance issues. (the total calculation amount= TableA row count * TabeB row count)
In addition, you can also try to use the following formulas if they help:
measure version:
CurrentDeliveryPriceGross =
VAR currdate =
MAX ( view_PBI_BTK_Sales[date] )
RETURN
CALCULATE (
MAX ( view_PBI_BTK_Delivery[price] ),
FILTER (
ALLSELECTED ( view_PBI_BTK_Delivery ),
[date] <= currdate
),
VALUES ( view_PBI_BTK_Sales[storeid] ),
VALUES ( view_PBI_BTK_Sales[CikkCsomEgysegId] )
)
Calculate column version:
CurrentDeliveryPriceGross =
CALCULATE (
MAX ( view_PBI_BTK_Delivery[price] ),
FILTER (
view_PBI_BTK_Delivery,
[storeid] = EARLIER ( view_PBI_BTK_Sales[storeid] )
&& CikkCsomEgysegId = EARLIER ( view_PBI_BTK_Sales[CikkCsomEgysegId] )
&& [date] <= EARLIER ( view_PBI_BTK_Sales[date] )
)
)
Regards,
Xiaoxin Sheng