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
navafolk
Helper IV
Helper IV

DAX measure: string search/find/contains with conditions

Hi pros,

I have a visual matrix like this:

C_DAYC_Type
13-Mar-20Actual
13-Mar-20No data
14-Mar-20Forecasted
14-Mar-20No data
14-Mar-20No data

I am trying to prepare a measure that can: If a C_DAY contains "Actual", then returns "true" to all rows of this C_DAY.

My failed trial: 

 

 

 

CAT = contains(filter(table,table[C_DAY]=table[C_DAY]),table[C_TYPE],"Actual")

 

 

 

 

C_DAYC_TypeCATExpected
13-Mar-20Actual

true

true

13-Mar-20No datafalsetrue
14-Mar-20Forecastedfalsefalse
14-Mar-20No datafalsefalse
14-Mar-20No datafalsefalse

Anyone, please help. Thank you.

7 REPLIES 7
amitchandak
Super User
Super User

@navafolk , Try a new measure like

if ( countx(Summarize(Table, Table[C_DAY], "_1",countx(filter(Table,Table[C_Type]="Actual"),C_DAY)),[C_DAY])>=1, "True","False")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AlB
Community Champion
Community Champion

Hi @navafolk 

 

Measure =
"Actual" IN CALCULATETABLE ( DISTINCT ( Table1[C_Type] ), ALL ( Table1[C_Type] ) )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs

Cheers 

SU18_powerbi_badge

Hi @AlB ,

It works perfectly, but it is quite hard for me to understand how it works. May you explain please?

Thank you again.

AlB
Community Champion
Community Champion

Hi @navafolk 

In every row of you table visual (except the Total) both C_Day and C_Type are being filtered. That's your filter context. You want to see all the C_Types for that specific date, so you need to clear the filter on C_Type but keep the one for C_day. That is what we do with

  CALCULATETABLE ( DISTINCT ( Table1[C_Type] ), ALL ( Table1[C_Type] ) )

which yields a one-column table with all the values of C_Type for the date in the current row.

Once we have that, we just need to check if "Actual" is one of those values. That can be done with the IN operator

"Actual" IN CALCULATETABLE ( DISTINCT ( Table1[C_Type] ), ALL ( Table1[C_Type] ) )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs

Cheers 

SU18_powerbi_badge

It is clear.

Big thanks @AlB 

Mariusz
Community Champion
Community Champion

Hi @navafolk 

 

Try this

Measure = 
CALCULATE(
    CONTAINS( 'Table', 'Table'[C_Type], "Actual" ),
    ALL( 'Table' ),
    VALUES( 'Table'[C_DAY] )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

Thank you @Mariusz@AlB 

They all work like a charm. Big thanks.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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