But i cant do this Both dates which are in the Script are coming from different tables and our both table are huge data if i reload again it will take huge time to reload and it will reload schedule to reload after an hour.
If your tables are huge I don't think you have a choice but to calculate this in the script. Create a summary table if necessary. A calculated dimension using date from two huge tables will very likely give you the error you see now. And even if it doesn't performance will likely be horrible.