Forum Discussion
DistintCount Different two Columns
Hi,
I have two columns from the data file as below.
| Company | Code |
| ABC | A |
| ASD | B |
| ABD | A |
| ABC | A |
| ASD | C |
| ABC | B |
| ABD | A |
| ABC | D |
| ABE | A |
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 Company | Count Number of Code |
| 1 | 3 |
| 1 | 2 |
| 2 | 1 |
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
- amitchandak
Super User
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])
- AnonymousNot 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
- amitchandak
Super User
Anonymous , How do get only three rows. Logic?
- parry2k
Super User
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?
- AnonymousNot 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.
- parry2k
Super User
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.⚡