Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
RichOB
Helper IV
Helper IV

Need help finishing my measure with a Contains section

Hi, using my table below I need a measure that gives me a count of all incident types containing "Aggression". The measure I currently have only selects the singular/exact word and gives me a count of 1 where I need a count of 4. FYI, I need those dates in the measure too.

 

Aggression_24 = (
    CALCULATE(
        Count(Table[Incident_Number]),
        'Table'[Type_of_Incident] = "Aggression",
        'Tables'[Date]>=DATE(2024,1,1),
        'Table'[Date]<=Date(2025,9,1)
    ))

 

DateIncident_Number Type_of_incident
01/01/20241Missing Person
01/02/20242Fall
01/03/20243Theft
01/04/20244Aggression, Threats
01/05/20245Aggression, ASB
01/06/20246Theft
01/07/20247Aggression, ASB, Violence
01/08/20248Medical Concern
01/09/20249Aggression

 

Thanks for your help

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @RichOB ,

 

try like:

Aggression_24 = (

    CALCULATE(

        Count(Table[Incident_Number]),

        CONTAINSSTRING('Table'[Type_of_Incident] ,"Aggression"),

        'Tables'[Date]>=DATE(2024,1,1),

        'Table'[Date]<=Date(2025,9,1)

    ))

View solution in original post

2 REPLIES 2
RichOB
Helper IV
Helper IV

Thanks very much @FreemanZ  !

FreemanZ
Super User
Super User

hi @RichOB ,

 

try like:

Aggression_24 = (

    CALCULATE(

        Count(Table[Incident_Number]),

        CONTAINSSTRING('Table'[Type_of_Incident] ,"Aggression"),

        'Tables'[Date]>=DATE(2024,1,1),

        'Table'[Date]<=Date(2025,9,1)

    ))

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.