Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

count if column

Hi,

 

I think there has to be an easy solution to my problem. 

 

I have a column where almost every value appears two times with a few exeptions:

 

ID_A

ID_A

ID_B

ID_B

ID_C

ID_C

ID_D

ID_E

ID_E...and so on

 

 

In this example i want to get rid of ID_D. To do so I wanted to create a new column in the Query Editor that works like a Count IF Formula in Excel so that I can filter out all ID's with just one entry. 

 

But I'm stuck here somehow :(

 

Screenshot

  • Hi Anonymous,

    In the Query Editor you should be able to Group BY Your ID Column, the default is a column with the count of the rows, and then also add the All Rows as the second aggregation column.

     

     

    Then filter the Count column to those that are not one.

    Remove the Count Column

    Expand the Column that contains tables (the All Rows column)

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    If you really want a column and not a measure, then you can do it by doing something along the lines of:

     

    Column = CALCULATE(COUNT(Table[ID]),FILTER(ALL(Table),Table[ID]=EARLIER(Table[ID])))

     

     

  • MarkS's avatar
    MarkS
    Resolver IV

    Hi Anonymous,

    In the Query Editor you should be able to Group BY Your ID Column, the default is a column with the count of the rows, and then also add the All Rows as the second aggregation column.

     

     

    Then filter the Count column to those that are not one.

    Remove the Count Column

    Expand the Column that contains tables (the All Rows column)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, this really did the job :)