Forum Discussion

Saxon10's avatar
Saxon10
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

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

 

ITEMSTATUS1TYPE
12345MATCHEDYES
123456MATCHEDYES
234567MATCHEDYES
345678MATCHEDYES
456789MATCHEDNO
567900MATCHEDNO
679011MATCHEDNO
790122MATCHEDNO
901233MATCHEDNO
1012344MATCHEDNO
1123455MATCHEDNO
1234566MATCHEDNO
1345677MATCHEDNO
1456788MATCHEDNO
1567899NOT MATCHEDNO
1679010NOT MATCHEDNO
1790121NOT MATCHEDNO
1901232NOT MATCHEDNO
2012343NOT MATCHEDNO
2123454NOT MATCHEDNO
2234565NOT MATCHEDNO
2345676NOT MATCHEDNO
2456787NOT MATCHEDNO
2567898NOT MATCHEDNO
2679009NOT MATCHEDNO
2790120NOT MATCHEDNO
2901231NOT MATCHEDNO
3012342NOT MATCHEDNO
3123453NOT MATCHEDNO
3234564NOT MATCHEDYES
3345675NOT MATCHEDYES
3456786NOT MATCHEDYES
3567897NOT MATCHEDYES
3679008NOT MATCHEDYES
3790119NOT MATCHEDYES

 

REPORT

 

REPORT
COMMENTSSTATUS1
MATCHED10
NOT MATCHED15

 

  • 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

  • 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's avatar
      Saxon10
      Icon for Post Prodigy rankPost 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.