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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

DAX: Discount Count Field does not contain a particular string

Hi Experts,

 

Below is my sample data. I need to the count distinctvalues of staff Name who haven't resigned. 

 

Please helpe me!

 

Thank you

 

Distinctcount.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try this:

 

Measure = 
VAR _t =
    FILTER (
        VALUES ( 'Table'[Staff Name] ),
        CONTAINSSTRING ( [Staff Name], "Resigned" ) = FALSE ()
    )
RETURN
    COUNTROWS ( _t )

 

Eyelyn9_0-1632451997569.png

 

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try this:

 

Measure = 
VAR _t =
    FILTER (
        VALUES ( 'Table'[Staff Name] ),
        CONTAINSSTRING ( [Staff Name], "Resigned" ) = FALSE ()
    )
RETURN
    COUNTROWS ( _t )

 

Eyelyn9_0-1632451997569.png

 

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

goncalogeraldes
Super User
Super User

Hello there @Anonymous ! 

 

Not Resigned =
var _select = SELECTEDVALUE(Table[Staff Name])
var _valid = RIGHT(_select, 10)
var _count = DISTINCTCOUNT(Table[Staff Name])

return
IF(
_valid <> "(Resigned)",
_count)

 

Hope this answer solves your problem! If you need any additional help please @ me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

Anonymous
Not applicable

Hi @goncalogeraldes 

Thank you very much for your quick help. I have applied your DAX, but i am not getting the correct result. The correct result should be 4. 

 

Below is the snap of shot.dIStinctcountdAX.PNG

Hello there @Anonymous ! What about this one?

Not Resigned =
var _select = SELECTEDVALUE(Table[Staff Name])
var _valid = RIGHT(_select, 10)
var _count = DISTINCTCOUNT(Table[Staff Name])

return
CALCULATE(
     _count,
     FILTER( 
           RIGHT( _select) <> _valid )
)

 Hope this answer solves your problem! If you need any additional help please @ me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors