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

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

Reply
Jayaselvan
Helper II
Helper II

Filter with text contains with AND Logic

Hello All,

I have a input file shown as below.

Jayaselvan_0-1662468738233.png

 

There are two filters brand, region

Output1:

Jayaselvan_1-1662468808532.png

 

Output 2:

Jayaselvan_2-1662468848526.png

 

File Link: https://docs.google.com/spreadsheets/d/16MQRA2GiufoQ7qGd1sxJK0ALPerScEsc/edit?usp=sharing&ouid=11763...

 

Please help in achieving this Output Table.

And also help me in creating the brand filter with each elements separetely like aaa, bbb, ccc.

 

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Jayaselvan 
Please refer to attached sample file with the solution

1.png2.png

Filtered Value = 
VAR SelectdBrands = VALUES ( Brands[Brand] )
RETURN
    SUMX ( 
        VALUES ( 'Table'[brand] ),
        VAR CurrentBrands = 'Table'[brand]
        VAR String1 = SUBSTITUTE ( CurrentBrands, "[", "" )
        VAR String2 = SUBSTITUTE ( String1, "]", "" )
        VAR String3 = SUBSTITUTE ( String2, "“", "" )
        VAR String4 = SUBSTITUTE ( String3, "”", "" )
        VAR String5 = SUBSTITUTE ( String4, " ", "" )
        VAR Items = SUBSTITUTE ( String5, ",", "|" )
        VAR Length = COALESCE ( PATHLENGTH ( Items ), 1 )
        VAR T1 = GENERATESERIES ( 1, Length, 1 )
        VAR T2 = ADDCOLUMNS ( T1, "@Brand", PATHITEM ( Items, [Value] ) )
        VAR T3 = SELECTCOLUMNS ( T2, "@@Brand", [@Brand] )
        VAR T4 = INTERSECT ( T3, SelectdBrands )
        RETURN
            IF ( COUNTROWS ( SelectdBrands ) = COUNTROWS ( T4 ), CALCULATE ( SUM ( 'Table'[value] ) ) )
    )

 

 

View solution in original post

10 REPLIES 10
tamerj1
Super User
Super User

Hi @Jayaselvan 
Please refer to attached sample file with the solution

1.png2.png

Filtered Value = 
VAR SelectdBrands = VALUES ( Brands[Brand] )
RETURN
    SUMX ( 
        VALUES ( 'Table'[brand] ),
        VAR CurrentBrands = 'Table'[brand]
        VAR String1 = SUBSTITUTE ( CurrentBrands, "[", "" )
        VAR String2 = SUBSTITUTE ( String1, "]", "" )
        VAR String3 = SUBSTITUTE ( String2, "“", "" )
        VAR String4 = SUBSTITUTE ( String3, "”", "" )
        VAR String5 = SUBSTITUTE ( String4, " ", "" )
        VAR Items = SUBSTITUTE ( String5, ",", "|" )
        VAR Length = COALESCE ( PATHLENGTH ( Items ), 1 )
        VAR T1 = GENERATESERIES ( 1, Length, 1 )
        VAR T2 = ADDCOLUMNS ( T1, "@Brand", PATHITEM ( Items, [Value] ) )
        VAR T3 = SELECTCOLUMNS ( T2, "@@Brand", [@Brand] )
        VAR T4 = INTERSECT ( T3, SelectdBrands )
        RETURN
            IF ( COUNTROWS ( SelectdBrands ) = COUNTROWS ( T4 ), CALCULATE ( SUM ( 'Table'[value] ) ) )
    )

 

 

Hello,

 

Thank you. That'a awesome. 

I wish to be excelled like you in DAX.

Could you please suggest any resources, YouTube videos or Courses that helped you.

@Jayaselvan 
Starting with "the definitive guide to dax" is the best way to learn how to think DAX. After that you will be able to create new things such as this one.

Jayaselvan
Helper II
Helper II

Please help @amitchandak , @lbendlin , @Rayshin , @tamerj1 , @SpartaBI 

 

onurbmiguel_
Power Participant
Power Participant

Hello 

 

Please take a look on my solution for that 

 

https://1drv.ms/u/s!AkcWVrMFkXs1h7MWr8PnmrO3yP-_VA?e=x9koO4

 

any question please ask 

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
Best Regards
BC

 


Best regards


Bruno Costa | Super User


 


Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! 


Take a look at the blog: PBI Portugal 


 


Hello,

 

Thanks for helping me out.

 

But I can't access the link(https://1drv.ms/u/s!AkcWVrMFkXs1h7MWr8PnmrO3yP-_VA?e=x9koO4) which you shared.

 

Jayaselvan_0-1662472385150.png

 

hello again, 

Can you try with different browser, i test it in chrome with incognito windows and works

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
Best Regards
BC

 


Best regards


Bruno Costa | Super User


 


Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! 


Take a look at the blog: PBI Portugal 


 


Hello,

 

Feeling sorry to bother you again. 

Still I can't access the link even in Google Chrome Incognito as well.

 

Jayaselvan_0-1662484384157.png

 

This is the version I my using in my Windows 10 machine.

Jayaselvan_1-1662484478386.png

 

Hi again, 

Try this link 

https://drive.google.com/file/d/19_ps__mKX0CZIteXBZnXRQ46p-sDCBBc/view?usp=sharing

 

BR 

Bruno 

 


Best regards


Bruno Costa | Super User


 


Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! 


Take a look at the blog: PBI Portugal 


 


Hello

Thank you, I can access the link now.

It satisfies Sample Output 1.

But the output 2(Selecting multiple brands) is not achieved here. We have to select the rows which contains all the selected value.

 

Your Output:

Jayaselvan_0-1662537413876.png

 

 

The expected Output

Jayaselvan_1-1662537413769.png

Helpful resources

Announcements
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 Kudoed Authors