Forum Discussion

kattlees's avatar
kattlees
Icon for Post Patron rankPost Patron
9 years ago
Solved

Distinct values based on multiple columns

I need to find distinct values in a table based on 3 columns.

 

Example of data would be:

 

PATNUM                SCHDT               SCHTM

123456                    71317                 08:00:00

123456                    71317                 08:00:00

654321                    71217                 08:30:00

654321                    71217                 19:15:00

987654                    71117                 11:15:00

987654                    71217                 05:00:00

 

123456 should return a count of 1, but 654321 & 987654 would both return 2.

 

I am very new to power bi any help would be appreciated.

  •  

    If it helps, it SUPER easy to do what you are asking in reverse...  You can select all 3 columns, then click 'Group By' and create a new Count Rows column.  Now the count will be 2 for 123456 and 1 for everyone else?  (Meaning that grouping of 3 data columns had 2 occurences, where the rest only had 1 distinct occurance of hte 3 columns.)

     

    Hope this helps a little...

    FOrrest

     

     

6 Replies

  • fhill's avatar
    fhill
    Icon for Resident Rockstar rankResident Rockstar

     

    If it helps, it SUPER easy to do what you are asking in reverse...  You can select all 3 columns, then click 'Group By' and create a new Count Rows column.  Now the count will be 2 for 123456 and 1 for everyone else?  (Meaning that grouping of 3 data columns had 2 occurences, where the rest only had 1 distinct occurance of hte 3 columns.)

     

    Hope this helps a little...

    FOrrest

     

     

    • kattlees's avatar
      kattlees
      Icon for Post Patron rankPost Patron

      Sorry for the newbie question, but how do I get to the screen you are showing. I have gone to modeling where I would usually create a new table, but I can't select more than one column at a time.  Are there videos or tutorials somewhere?

      • fhill's avatar
        fhill
        Icon for Resident Rockstar rankResident Rockstar

        When you 'Get Data' select 'Edit' during the import process, or after import select 'Edit Queries' from the Home Tab of the Desktop Client.