Forum Discussion
DAX Measure help - First Post
- 5 years ago
Hi ka047 ,
If you think there is something wrong with your yellow part lines in your fomula, you can modify it like this:
NOT ISBLANK ( [DeliveryDate] ) && [Shipdays] == 0The whole formula:
Measure 3 = VAR summary = SUMMARIZE ( Fact_SalesCogs, Fact_SalesCogs[SalesOrder], Fact_SalesCogs[ShippingDateConfirmed], Fact_SalesCogs[DeliveryDate], Fact_SalesCogs[DropShippedInd], "Shipdays", CALCULATE ( AVERAGEX ( Fact_SalesCogs, DATEDIFF ( Fact_SalesCogs[ShippingDateConfirmed], Fact_SalesCogs[DeliveryDate], DAY ) ) ) ) RETURN SUMX ( summary, IF ( NOT ISBLANK ( [ShippingDateConfirmed] ) && ( NOT ISBLANK ( [DeliveryDate] ) && [Shipdays] == 0 || ( NOT ISBLANK ( [DeliveryDate] ) && ( Fact_SalesCogs[DropShippedInd] = 1 && [Shipdays] <= 1 && [Shipdays] >= 0 || Fact_SalesCogs[DropShippedInd] = 0 && [Shipdays] <= 3 && [Shipdays] >= 0 ) ) ), 1, 0 ) )If [Shipdays] is a number type column, [Shipdays] = 0 and [Shipdays] == 0 are different:
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I have now altered the DAX measure to be the below but unsure if it's working or not. Any help or confirmation??
OTD=
var summary =
summarize (Fact_SalesCogs,
Fact_SalesCogs[SalesOrder],
Fact_SalesCogs[ShippingDateConfirmed],
Fact_SalesCogs[DeliveryDate],
Fact_SalesCogs[DropShippedInd],
"Shipdays",
calculate(
AVERAGEX(
Fact_SalesCogs, datediff( Fact_SalesCogs[ShippingDateConfirmed],Fact_SalesCogs[DeliveryDate], day)
))
)
return
sumx(summary,
if(
and(
not(isblank([ShippingDateConfirmed])),
OR(
and(
not(isblank([DeliveryDate]))
,
[Shipdays] = 0)
,
and(
not(ISBLANK([DeliveryDate]))
,
or( Fact_SalesCogs[DropShippedInd] = 1 && AND(
[Shipdays] <=1,[Shipdays] >=0),
Fact_SalesCogs[DropShippedInd] = 0 && AND(
[Shipdays] <=3,[Shipdays] >=0)
)
)
)
),
1,0
)
)