Forum Discussion

UK_User123456's avatar
UK_User123456
Resolver I
7 years ago

Count or distinct count

Hi Community,

 

I have a column in my data that has a type of "text" but when I try to do a count or distinct count of the data, it just doesnt work. Can anyone help?

 

The example is as follows:

 

Code
4110 - Uni
4112 - Coll
4131 - Store
4121 - STA
4110 - Uni
4110 - Uni
4110 - Uni
4121 - STA
4131 - Store
4131 - Store
4121 - STA
4131 - Store
4131 - Store
4121 - STA

 

The output should be:

CodeCount
4110 - Uni4
4112 - Coll1
4131 - Store5
4121 - STA4

 

Any help would be greatly appreciated.

 

TIA

8 Replies

  • richbenmintz's avatar
    richbenmintz
    Resident Rockstar

    Hi UK_User123456 

     

    The following measures should give you the counts you are looking for

     

    Count = CountRows('table')
    Distinct Count = DISTINCTCOUNT('table'[column])

    I hope this helps,

     

    Richard

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi UK_User123456 ,

     

    Don't know what steps you are following .However when I tried with your example in a table Visual, I get the output as expected:

    see screnshot below:

     

    Thanks,

    Tejaswi

    • UK_User123456's avatar
      UK_User123456
      Resolver I

      But would this work if it was referenceing a measure that was calculated?

      • UK_User123456's avatar
        UK_User123456
        Resolver I

        I have a calculated measure that is based upon a ranking column in my base data, I then wanted to count the number of times those codes appear.