I am trying to do a days of stock calculation in powerpivot and struggling to get it to work. In excel the calcualtion would be alonf the lines of:

if(Average 4 weeks forward forecast>0) (TEF Stock + VMI Stock) / Average 4 weeks forward sales forecast= DOS

I need this as a measure so when I move between views, from item to vendor etc it calculates still, can anyone please help?