I'am still not sure if it is my fault or maybe some bug. Thjs is why i am asking if somebody have seen it before.
My data model is rather complex, but the field whose count is counted occurs only in one table. I understand if I used a dimension from another table, but if I throw as a dimension to the chart field, and as a measure count on the same field, and if the field appears only and only in that table, why the result is different from result when I add as next dimension another field from the same table?
Even if there are duplicates in the data, it seems that the result should be the same
(my app purpose is finding duplicates, .... )
And how to tell business user - don't use count(), because results may be wrong?
Without seeing your full app, load script & data model it is hard to reply definitively, but have a look at this Blog Post To Join or not to Join. It may help you find what has gone adrift in your app.
Taking special note of this bit I have pasted below.
It minimizes the risk for incorrect calculations. Joins potentially change the number of records in the tables, which means that a normal Sum() or Count() function cannot always be used – they would sometimes return an incorrect result. You may counter that there is always a way to write a correct formula, but my point is that it should also be easy. Expressions in server objects will be written by users that do not have special knowledge about the data model in the app.
First thing i do when i saw those results was checking, if some joined data do not multiply rows in my table. But it shouldn't.
Still, in any data model, I can not understad why my two charts shows different results if all fields are present in one table, i selected only exactly one ID value and no other selections was made. OK, there may be one case, if additional dimension in one of 3 rows has value and in 2 other rows null, and my charts excludes nulls. I will checki it But if not:
a) If counted field is a key, which have more than one row in any table of my data model, i would expect, that both of charts will show it, (3 should be result even if i take some additional dimension)
b) if counted field is present only in one table, then still adding any other field as next dimension from the same table should not change results:
In any case (except case, when additional dimension has nulls on 2 from 3 rows and nuls excluded by chart) i expect, that both charts will give the same results....
Maybe QS makes something wrong in this specific case, when dimension and measure is on the same field and no other field present on chart ....
I will try to reproduce this behaviour with non production data, and maybe with few less tables, than in oryginal model. Then i will send. I tryed to make the same with few rows and 2 tables, but then results are correct ... Maybe it is something wrong with my app. During developement it was reloaded and changed many Times Anyway, different results in two charts are strange.
Now, after some additional investigation it looks like my ID was a key, and occured few Times in some detail table. So, chart with ID and count (ID) told true. But why, after adding dimension from master table (where row occurs only once) , result changes and dont see, that ID occurs more Times in details? I prepepared app with 2 tables and few rows, and there, after adding dimension from master table results in two charts are the same. Count in both charts shows numer of rows in detail table ..... Strange