It would be much easier to help you if you provided more details. Its hard to diagnose and fix "incorrect result". The best would be a small qvw file containing sample data and the chart/table that illustrates the problem, along with the output you want.
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein