Forum Discussion
dax Error
Following DAX is giving me an error. Please help
GP Yeild KG =
var prodA=divide ( CALCULATE(Sum(DBALLSTAT[Profit])),CALCULATE(Sum(DBALLSTAT[ChglWt(KG)]),Group_Logic[Mode_group_3]="AIR"))
var prodB=Divide(CALCULATE(Sum(DBALLSTAT[Profit])),CALCULATE(Sum(DBALLSTAT[Tues]),Group_Logic[Mode_group_3]="OCEAN"))
var ProdC=divide(CALCULATE(Sum(DBALLSTAT[Profit])),CALCULATE(Sum(DBALLSTAT[ChglWt(KG)])) )
var ProdD= if([Mode_group_3]="Air",divide(prodA,prodB),Divide(ProdA,ProdC))
return ProdD
var prodA= CALCULATE(Sum(DBALLSTAT[Profit])) var ProdA1=CALCULATE(Sum(DBALLSTAT[ChglWt(KG)]))
var prodB=CALCULATE(Sum(DBALLSTAT[Profit])) var ProdB2=FLOOR(CALCULATE(sum(DBALLSTAT[Tues]) +(sum(DBALLSTAT[CBM])/25)),1)
var ProdC=CALCULATE(Sum(DBALLSTAT[Profit])) var ProdC2=CALCULATE(Sum(DBALLSTAT[ChglWt(KG)]))
var ProdD= if (SELECTEDVALUE(Group_Logic[Mode_group_1])="AIR",divide(prodA,ProdA1), if(SELECTEDVALUE(Group_Logic[Mode_group_1])="OCEAN",divide(ProdB,ProdB2),divide(ProdC,ProdC2)))
6 Replies
- amitchandakSuper User
sakshikaul , You have to change var ProdD like this and try
var ProdD= if(max([Mode_group_3])="Air",divide(prodA,prodB),Divide(ProdA,ProdC))
- sakshikaulHelper III
Still getting the error
- AnonymousNot applicable
Hisakshikaul,
According to the image you provided, the highlighted section needs to be re-referenced, and not referencing the column correctly is causing this error.
Hope it helps.
Best Regards,
Caitlyn YanIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.