14 Replies Latest reply: Apr 30, 2017 2:43 PM by Tomasz Truszkowski RSS

    Is it known behaviour?

    Dariusz Mielczarek

      I;am trying to understand my app

      On the picture you have few fields. All fields only in one table of data model.

      In source data it looks like it is no duplicate. I also checked data, which i join to this table, and it should no multiply.

       

      When i put into table only ID field and count (ID), my table (or barchart) shows, that i have 3 rows.

      If i put to this chart any addisional field (from the same table of data model), the same measure shows 1....

       

      I know of course, that i may use distinc But what if i would like really count rows? I dont like to put "1" to each row of each table

       

       

       

      Every suggestion is welcome.


      Best regards

      Darek

      P.S - i'am on desktop with about 100k rows, about 10 tables in data model.

        • Re: Is it known behaviour?
          Bill Markham

          I often put a counter field in a table that is set to 1 for every row.

           

          Is there is reason why you do not wish to do this ?

            • Re: Is it known behaviour?
              Dariusz Mielczarek

              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?

               

              I still hope that it is only my mistake ....

                • Re: Is it known behaviour?
                  Bill Markham

                  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.


                  Maybe then also have a look at this Blog Post, Don't join - use Applymap instead.