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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX Measure error using containstring function

Hi Experts

 

I am trying to exclude in the column "UnsafeActByPeople where we have the text "No human contributing factor". 

My error message two few arugments passed to the CONTIANSTRING  function

m_count_coworker_LTA_UnsafeActByPeople_PSK = 
var result=
CALCULATE(COUNT(vw_fct_irs_accidents[irs_accidents_bk]),
        FILTER(vw_fct_irs_accidents, 'vw_fct_irs_accidents'[TypeOfPersonInjured]="Co-Worker" && 
        'vw_fct_irs_accidents'[AccidentResultedInLostTime]= "Yes" &&  
        'vw_fct_irs_accidents'[incident_category_master]="Injury accident" && 
        NOT(CONTAINSSTRING(vw_fct_irs_accidents[UnsafeActsByPeople] = "No human contributing factor"))))
RETURN
    IF(ISBLANK(result),0,result)

 

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous 

Try the following measure

m_count_coworker_LTA_UnsafeActByPeople_PSK =
VAR result =
    CALCULATE (
        COUNT ( vw_fct_irs_accidents[irs_accidents_bk] ),
        FILTER (
            vw_fct_irs_accidents,
            'vw_fct_irs_accidents'[TypeOfPersonInjured] = "Co-Worker"
                && 'vw_fct_irs_accidents'[AccidentResultedInLostTime] = "Yes"
                && 'vw_fct_irs_accidents'[incident_category_master] = "Injury accident"
                && CONTAINSSTRING (
                    vw_fct_irs_accidents[UnsafeActsByPeople],
                    "No human contributing factor"
                )
                    = FALSE ()
        )
    )
RETURN
    IF ( ISBLANK ( result ), 0, result )

 

Best Regards!

Yolo Zhu

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.