Forum Discussion

TTeam's avatar
TTeam
New Member
4 years ago
Solved

Group by AND count independently on a same table

Here is my data

Table1:

Name

Owner

John

Alice

Peter

Alice

Peter

John

 

Expected Result:

NameCount OwnerCount
John1Alice2
Peter2John1

 

How could I group and count 2 different columns like this and present on a same chart please

Thanks

  • Hi, TTeam ;

    You could create a measure.

    Measure = CALCULATE(COUNT('Table'[Name]),FILTER(ALL('Table'),[Owner]=MAX('Table'[Owner])))

    then add field.

    The final output is shown below:


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi TTeam 

     

    In the data the Name "Peter" has 2 different owners. So if you use both columns in one visual "Peter" will have both the corresponding owners.

     

    However you can get something like this 

     

    Using the below measures

    Name_count =
    CALCULATE (
    COUNT ( Table1[Name] ),
    ALLEXCEPT (
    Table1,
    Table1[Name]
    )
    )
     
    Owner_count =
    CALCULATE (
    COUNT ( Table1[Owner] ),
    ALLEXCEPT (
    Table1,
    Table1[Owner]
    )
    )
     
    If this post helps, Accept it as a solution.
  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi, TTeam ;

    You could create a measure.

    Measure = CALCULATE(COUNT('Table'[Name]),FILTER(ALL('Table'),[Owner]=MAX('Table'[Owner])))

    then add field.

    The final output is shown below:


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.