Forum Discussion
ka047
5 years agoHelper I
DAX Measure help - First Post
I am trying to put an IF( AND( statements added into my dax measure (Which I will post below). The problem I am running into is where to put those statements & how to based on the field not being a m...
- 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.
lbendlin
5 years agoSuper User
instead of AND() you can use &&.
if(a>3 && b=0 && c<10 && d=5,this,that)
for OR() you can use ||
- ka0475 years agoHelper I
For the below measure, what would change from what you referred to?
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))))returnsumx(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))