We need some sample data and I think more explanation of what you are doing.
and you might find this useful