I followed your suggestions but... I give ZERO..
this is the load script piece. DATA2 is the field we are handling.
This is the preview:
these are our two variables: vFromDate and vToDate (don't worry about "V" capital letter, I've fixed it)
this is QUANT_AC: the quantity (AC = current year) sum within a date range (vFromDate to vToDate)
I give a great 0.. to all rows...
Looks like you are using master measure and calling it a variable.
Add variables by clicking 'x' icon in bottom left corner.
Then click "create new" and put a name & expression.
Make sure you add an equal sign before variable definition.
See the part highlighted in yellow.
Date# is a dual data type function that means it will store both num and text.
Date# gives you both 20160107 and 42376.
To keep the number part use num(Date#([DAT_DOC],'YYYYMMDD')) AS DATA.