This looks like a data model problem. I suggest that you post a sample qvd file with a subset of the real data that exhibits the problem for accurate diagnosis. At the very minimum, post your expression and a diagram of your data model.
In the meantime, do you perform a join in the load that is adding data records due to a non-unique key? Or does the expression span tables with different granularity levels?
Here is a simple qvw-file that shows the problem. Line1 has two MajorGrade-types so the x-axes shows two eventhough the calculation gives one. My data loads from one excel file that has multiple lines per unit if it is connected to different types of grades.
Does this help?
DoubleCountExample.qvw 149.2 K
You are using Dimension as MajorGrade as Dimension and Line1 is applicable for both the MajorGrades. In chart the distinct count is calculated by Dimension, that is why you are getting Line1 in both the MajorGrades and getting count as 2.
If you remove MajorGrade, then your count will be 1 only. To solve this you can mark the first entry to one of the MajorGrades in script and use the Sum of it in the expression
load * inline [
Name, MajorGrade, Area
Line1, Market, EMEA
Line1, Tissue, EMEA
Line2, Market, EMEA
If(Peek(Name) <> Name, 1, 0) AS Count
ORDER BY Name, Area, MajorGrade;
DROP TABLE Temp;
Now in chart use below expression
Hope this helps you.