Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Add Count Column

I need to create a new column where I can get the Count of reservationId per clientId.
I have reservationId and clientId, reservationId is distinct.



I create a table to get count of reservationId per ClientId below:

Similarly I need that count in column.

 



  • Hi Anonymous 

     

    It should be 

    T.Count = COUNTX (FILTER ( 'public Reservations', [clientId] = EARLIER ( [clientId] ) ),[reservationId])

     

    Take care of pairs of parentheses. One ")" in your DAX formula just isn't at the correct position.  

     

    Best Regards,
    Community Support Team _ Jing

5 Replies

  • Anonymous , a new column

    countx(filter(Table, [clientid] =earlier([clientid]) ,[reservationid])

    • Anonymous's avatar
      Anonymous
      Not applicable

      Its giving Unexpected Parameter.

      Furthermore, I am trying to get the column via Power Query Editor. amitchandak 

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , this was dax, one correct

         

        countx(filter(Table, [clientid] =earlier([clientid])) ,[reservationid])

         

        for power query create a new table that group by client id and merge that with this table