Forum Discussion
COUNT BY MULTIPLE COLUMNS
Hi,
I am trying to count by multiple columns status and type.
I have two tables are data and report. In data table contain three columns are Item, status and type and report table contain status.
In data table:
Item column contain text and numbers.
Status column contain "Matched" and "Not Matched" according to the item.
Type column contain "Yes" and "No" according to the item.
In Report table;
Status column contain "Matched" and "Not Matched".
I would like to get the count according to the status "Matched" and "Not Matched" by "Type" is "No" only?
I am apply the following DAX , STATUS = CALCULATE(COUNT(DATA[STATUS]),FILLTER(ALL(DATA),DATA[STATUS]=EARLIER(REPORT[STATUS)))). How can I add "Type" columns status is "No" only in my exciting DAX?
Can you please advise.
DATA & REPORT TABLE;
DATA
| ITEM | STATUS1 | TYPE |
| 12345 | MATCHED | YES |
| 123456 | MATCHED | YES |
| 234567 | MATCHED | YES |
| 345678 | MATCHED | YES |
| 456789 | MATCHED | NO |
| 567900 | MATCHED | NO |
| 679011 | MATCHED | NO |
| 790122 | MATCHED | NO |
| 901233 | MATCHED | NO |
| 1012344 | MATCHED | NO |
| 1123455 | MATCHED | NO |
| 1234566 | MATCHED | NO |
| 1345677 | MATCHED | NO |
| 1456788 | MATCHED | NO |
| 1567899 | NOT MATCHED | NO |
| 1679010 | NOT MATCHED | NO |
| 1790121 | NOT MATCHED | NO |
| 1901232 | NOT MATCHED | NO |
| 2012343 | NOT MATCHED | NO |
| 2123454 | NOT MATCHED | NO |
| 2234565 | NOT MATCHED | NO |
| 2345676 | NOT MATCHED | NO |
| 2456787 | NOT MATCHED | NO |
| 2567898 | NOT MATCHED | NO |
| 2679009 | NOT MATCHED | NO |
| 2790120 | NOT MATCHED | NO |
| 2901231 | NOT MATCHED | NO |
| 3012342 | NOT MATCHED | NO |
| 3123453 | NOT MATCHED | NO |
| 3234564 | NOT MATCHED | YES |
| 3345675 | NOT MATCHED | YES |
| 3456786 | NOT MATCHED | YES |
| 3567897 | NOT MATCHED | YES |
| 3679008 | NOT MATCHED | YES |
| 3790119 | NOT MATCHED | YES |
REPORT
| REPORT | |
| COMMENTS | STATUS1 |
| MATCHED | 10 |
| NOT MATCHED | 15 |
Saxon10 add following measure:
CALCULATE(COUNT(DATA[STATUS]),DATA[Type]= "NO" )in table visual, put status column and above measure and you will get the answer.
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.⚡
2 Replies
- parry2k
Super User
Saxon10 add following measure:
CALCULATE(COUNT(DATA[STATUS]),DATA[Type]= "NO" )in table visual, put status column and above measure and you will get the answer.
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.⚡
- Saxon10
Post Prodigy
thanks for your reply.
I want calculated column. I would like to get the count based on the columns “Status” and “Type” according to the Report Table.
Can you please advise.