Your Julian Date is not recognized as a date.
You can see that on the fact that it is left-aligned. The reason is that you in the script have a date like '41640' and you try to interpret this using Date#(DataGen, 'YYYYMMDD'). You should not interpret it - it already has the right numeric value. Instead you should format it using Date() with a format that is to be used in the Set Analysis.
Or, skip the format and use numeric values all through. (also in the Set Analysis.)
Henric Sir is Absolutely right.
You have an Auto generated Dates which is in Number format
You have created variables i.e. vDataAl & vDataDal . Both of them are is Number Format.
I have seen you have used Date# function which is of no need.
Use your original Autogenerated field which is Number format already and see the result.
Also see the Attachment where i have used new code.
Calendar Julian.qvw 234.5 K