I think your formula is a unnecessarily complicated.
First, you don't need to reference @CURRMBR("Period")->"No_Dept"; in that context it's exactly the same as "No_Dept".
Second, you should use @PRIOR to get the previous level-zero member in the dimension tagged as Time. If you have quarter roll-ups, then @PREVSIBLING on "Apr", "Jul" and "Oct" will return empty, not "Mar", "Jun", "Sep" - "Apr" doesn't have a previous sibling if it's the first child of "Qtr2". I would guess (I don't have your outline) that this is what's actually causing the problem, based on the error message.
So something like...
IF("No_Dept" == #MISSING) "D_Flag" = @PRIOR("No_Dept"); ENDIF
Is department a sparse dimension? TimG is on the right track. The @Prior command should do the trick as long as you set the member block on a sparse dimension. If you set it on a dense dimension, then it will not create a block. If on sparse, it will.
Is the member "No_Dept" in a sparse dimension?
Is the member "D_Flag" in the same dimension? If not is it in a sparse dimension? Or, is it a dense dimension? Is it the accounts dimension?
The way you have written the code, it does not know from which account to get the prior value. If you wrote it this way:
IF("No_Dept" == #MISSING)
"D_Flag" = @PRIOR("D_Flag");
It would work, because you've fixed on "Sales", so it knows the account. Opening the calculation block with "Sales" tells the script what account to put the result in, but not from which account the prior value must be retrieved. Hope that helps. Also, please mark the question as answered.