Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to create distinct count by column

Office Name

Desk Type

Count Desks Type by Office Name

Finance

Complex

2

Finance

Basic

2

Finance

Complex

2

HR

L-Shape

1

HR

L-Shape

1

IT

U-Shape

3

IT

Basic

3

IT

Complex

3

IT

U-Shape

3

 

The goal is to create the calculated column “Count Desk Type by Office Name”.

This column is built off of the distinct count of desk type for each office name.

How would we accomplish this in Power BI?

  • Hi, Anonymous 

     

    Please try the below for a calculated column.

     

     

    Count Desk Type by Office Name =
    CALCULATE (
    DISTINCTCOUNT ( 'Table'[Desk Type] ),
    ALLEXCEPT ( 'Table', 'Table'[Office Name] )
    )
     

    Hi, My name is Jihwan Kim.

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

3 Replies

  • Hi, Anonymous 

     

    Please try the below for a calculated column.

     

     

    Count Desk Type by Office Name =
    CALCULATE (
    DISTINCTCOUNT ( 'Table'[Desk Type] ),
    ALLEXCEPT ( 'Table', 'Table'[Office Name] )
    )
     

    Hi, My name is Jihwan Kim.

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you sir!

    • Anonymous's avatar
      Anonymous
      Not applicable

      How can I do this using the Power Query Editor by adding "Custom Column"?
      Instead of doing it within the Fields -> "Add Column" DAX method.
      Jihwan_Kim