Not able to select primary value for dimension in Drawing

Hiee All,

I am facing problem while selecting the primary value for dimension in drawing (refer pic) however its not driven dimension sometimes i can select the primary value , and sometimes SolidWork not allow me to select that value. (refer pic)

Why It is happening, does anyone know the reason??

SolidworksApi/macros