March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I've been tasked with 'speeding up' this DAX measure but I'm not sure where to start, does anybody have any suggestions on a way to make this measure work faster obviously still get the same result? Apologies if in the wrong forum
AvgStockOfDays2 =
var avgcnt = max('Product'[CountOfDaysFwd])
VAR FirstDayMAT = MAX ( PlanDueDate[PlanDueDate_DateSeqNumber])+1
VAR LastDayMAT = FirstDayMAT + (avgcnt -1)
Var StockOH =
CALCULATE (
SUM ( Inventory_Measures[m_QtyOnHand] ),
LASTNONBLANK ( LoadDate[LoadDatePK], CALCULATE ( SUM (Inventory_Measures[m_QtyOnHand] ) ) )
)
VAR Period4W =
CALCULATETABLE (
VALUES (PlanDueDate[PlanDueDatePK] ), ALLEXCEPT (
'PlanDueDate',
'PlanDueDate'[PlanDueDate_DayOfWeek]
),
'PlanDueDate'[PlanDueDate_DateSeqNumber] >= FirstDayMAT
&& PlanDueDate[PlanDueDate_DateSeqNumber] <= LastDayMAT
)
VAR AvgMrp =
CALCULATE (
AVERAGEX ( Period4W,IF(ISBLANK( [QtyMrpFull]),0,[QtyMrpFull])
),
ALL(PlanDueDate)
)
Var result =
DIVIDE(StockOH,AvgMrp,0)
RETURN
Result
Thanks
Hi @benZert
Is the [QtyMrpFull] a measure? If so, what is its formula? In this section, it will be evaluated twice. So if you can evaluate it only once, it may improve the performance to some degree.
Try
AVERAGEX (
Period4W,
VAR _qtyMrpFull = [QtyMrpFull]
RETURN
IF ( ISBLANK ( _qtyMrpFull ), 0, _qtyMrpFull )
)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
165 | |
116 | |
63 | |
57 | |
50 |