Forum Discussion

RichOB's avatar
RichOB
Icon for Post Partisan rankPost Partisan
1 year ago
Solved

Measure / DAX to obtain a count

Hi, I need to get the count of the individual incident types when there are multiple selections per incident. For example, using the table below, I need to count the types like this:

 

ASB - 5 

Discrimination - 1

Fire - 2 

Medical Concern - 3

Theft - 3

 

IncidentIncident_TypeDate
1ASB, Discrimination2024
2ASB2024
3Fire, Theft2024
4Medical Concern2024
5Theft, ASB, Fire2024
6Medical Concern, ASB2024
7ASB, Theft2024
8Medical Concern2024

 

Thanks

  • RichOB Go to the Power Query Editor by clicking on Transform Data.
    Select the Incident_Type column.
    Go to the Home tab, then click on Split Column > By Delimiter.
    Choose Comma as the delimiter and select Split into Rows.

    After splitting the column, you will have a new table where each incident type is in its own row.
    Rename the new column to Incident_Type.

     

    Create a new measure to count the occurrences of each incident type.

    IncidentTypeCount = COUNTROWS('YourTableName')

     

    Use a Table or Matrix visualization.
    Add the Incident_Type column to the rows.
    Add the IncidentTypeCount measure to the values.

     

2 Replies

  • RichOB Go to the Power Query Editor by clicking on Transform Data.
    Select the Incident_Type column.
    Go to the Home tab, then click on Split Column > By Delimiter.
    Choose Comma as the delimiter and select Split into Rows.

    After splitting the column, you will have a new table where each incident type is in its own row.
    Rename the new column to Incident_Type.

     

    Create a new measure to count the occurrences of each incident type.

    IncidentTypeCount = COUNTROWS('YourTableName')

     

    Use a Table or Matrix visualization.
    Add the Incident_Type column to the rows.
    Add the IncidentTypeCount measure to the values.

     

  • Hi RichOB 
    You can split these rows vertically  from PQ :

    + Trim to clean unnesassary spaces:

     


    Result :

    The pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly