Forum Discussion

pal95's avatar
pal95
Icon for Helper III rankHelper III
1 year ago
Solved

DAX Measure to count only rows with specific text

Hi, I have a table that should show the total number of SOP documents read by a user.


I am creating a table like this for that:

 

Below is the table I take values from:

 

In the column "SOP 2," I would like to use this table to count only the rows containing the "SOP" text in the 'Document Type' column. This should automatically show the total number of rows with "SOP" for each user name.

 

How to do this through measures? Please let me know if you need any more information

 

 

  • Hi pal95 

    I think this should do the trick.

    MEASURE =
    CALCULATE ( COUNT ( Table1[SOP 2] ), Table2[Document Type] = "SOP" )

    I hope this solved your problem 🙂

  • Fair enough that will just make it easier if all the data is in one table.
    I will write table as a placeholder for your tables name where the data is.
    MEASURE =
    CALCULATE ( COUNT ( Table[User Name] ), Table[Document Type] = "SOP" )

3 Replies

  • ThomasWeppler's avatar
    ThomasWeppler
    Icon for Impactful Individual rankImpactful Individual

    Hi pal95 

    I think this should do the trick.

    MEASURE =
    CALCULATE ( COUNT ( Table1[SOP 2] ), Table2[Document Type] = "SOP" )

    I hope this solved your problem 🙂

    • pal95's avatar
      pal95
      Icon for Helper III rankHelper III

      No, sorry, table 1 isn't real - it is just something that I created through PowerBI, so I cannot reference it. It should all be through the table 2

      • ThomasWeppler's avatar
        ThomasWeppler
        Icon for Impactful Individual rankImpactful Individual

        Fair enough that will just make it easier if all the data is in one table.
        I will write table as a placeholder for your tables name where the data is.
        MEASURE =
        CALCULATE ( COUNT ( Table[User Name] ), Table[Document Type] = "SOP" )