Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

DistintCount Different two Columns

Hi,

 

I have two columns from the data file as below.

 

CompanyCode
ABC A
ASDB
ABDA
ABC A
ASDC
ABC B
ABDA
ABC D
ABEA

 

I want to make a count on two columns to return a table below or a similar visual which can show the following result on the desktop. I wonder if anyone knows how?

 

Number of CompanyCount Number of Code
13
12
21

 

 

Cheers

Jimmy

  • Anonymous solution attached, change it as per your need

     

    Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

     

6 Replies

  • Anonymous , You have display count of both columns with Company in viusal .

     

    So in visual add

    Company (Unsummarized)

    Company (Count) Or use measure  Count(Table[Company])

    Code(Count) Or use measure  Count(Table[Code])

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your reply.

       

      I tried the way you suggested however it won't have the visual like what's in my second table.

       

      It will only give me a list of all companies and the count of their code accordingly, like below

       

       

       

  • Anonymous what is the logic of the count of the first and 2nd column, sample data you showed has 9 rows but none of the total count in the expected output count to 9. You need to provide the logic for the count, is it a distinct count or what?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your reply.

       

      The reason I was doing it is because I wanted to see the number of the companies are having 3 codes, 2 codes, 1 code or none. 

  • Anonymous solution attached, change it as per your need

     

    Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.