Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Measure calculating difference between two distinct counts not giving correct answer

Hi there,

I have two columns in a table visualisation, which show the distinct counts of ID fields. I have also created a measure which should just show the difference between the distinct counts:


Difference = DISTINCTCOUNT(dat4[id]) - DISTINCTCOUNT(dat4[GIN.Number])

 

...but it isn't working. In the image below, you can see that the difference is correct for some entries and not for others. Anyone know why this might be?

 

Regards,

Will

 

  • Hi Anonymous,

     

    Yes, the value of "Count (Distinct)" setting in the visual is equal to the measure with COUNT and DISTINCTCOUNT function.

     

     

    Best  Regards,

    Cherry

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    On further investigation, it seems that the DISTINCTCOUNT function is giving a different count to using the 'Count (Distinct)' value setting in the table visualisation. Anyone know why this would be?

     

    I added two measures of just the DISTINCTCOUNT(id variable) to the table visualisation, and as you can see, the counts are different (see 04/08/2018)...

     

     

     

    Regards,

    Will

    • Anonymous's avatar
      Anonymous
      Not applicable

      I think it must be to do with blanks in one of the ID fields. I think that the visualisation Count (Distinct) setting must count (blank) as a distinct value, whereas the DISTINCTCOUNT function does not.

       

      Will

      • v-piga-msft's avatar
        v-piga-msft
        Resident Rockstar

        Hi Anonymous,

         

        The fucntion COUNT and DISCOUNT are different. Here is a simple example, you may could see the difference from the image below.

         

        You also could have a good look at the document about COUNT and DISTINCTCOUNT function.

         

        If you still need help, please feel free to ask.

         

        Best  Regards,

        Cherry