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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Apply Filter and Contains into Search

I am trying to apply a new measure that inculdes a Filter and a contains. i have the below code:
 
Techniques =
CALCULATE(
DISTINCTCOUNT( 'enterprise-attack'[url] ),
FILTER(
'enterprise-attack',[Value.x_mitre_platforms] in {"Windows","Linux","macOS"}
)
)
 
i need to add a CONTAINS for the URL field so if the URL Field CONTAINS "Techniques" as well as the other filter. 
1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Here you need to use function 'CONTAINSSTRING' rather than 'CONTAINS'.

'CONTAINS' judges whether this value ‘https://attack.mitre.org/techniques/ ’ is equal to the value in the column, and 'CONTAINSSTRING' judges whether the value ‘https://attack.mitre.org/techniques/ ’ is part of the value  in the column.

 

Please change your measure as below:

 

Techniques = 
CALCULATE(
DISTINCTCOUNT( 'enterprise-attack'[url] ),
FILTER('enterprise-attack',[Value.x_mitre_platforms] in {"Windows","Linux","macOS"} && CONTAINSSTRING('enterprise-attack'[Url],"https://attack.mitre.org/techniques/"))
)​

 


 CONTAINSTRING VS. CONTAINS

 

29.png

 

Best Regards,
Community Support Team _ Eason
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

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

Here you need to use function 'CONTAINSSTRING' rather than 'CONTAINS'.

'CONTAINS' judges whether this value ‘https://attack.mitre.org/techniques/ ’ is equal to the value in the column, and 'CONTAINSSTRING' judges whether the value ‘https://attack.mitre.org/techniques/ ’ is part of the value  in the column.

 

Please change your measure as below:

 

Techniques = 
CALCULATE(
DISTINCTCOUNT( 'enterprise-attack'[url] ),
FILTER('enterprise-attack',[Value.x_mitre_platforms] in {"Windows","Linux","macOS"} && CONTAINSSTRING('enterprise-attack'[Url],"https://attack.mitre.org/techniques/"))
)​

 


 CONTAINSTRING VS. CONTAINS

 

29.png

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

smpa01
Super User
Super User

@Anonymouscan you try this

FILTER(
'enterprise-attack',[Value.x_mitre_platforms] in {"Windows","Linux","macOS"} && CONTAINS())

 

if it does not work please provide a sample data

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

I have tried 

 

Techniques =
CALCULATE(
DISTINCTCOUNT( 'enterprise-attack'[url] ),
FILTER('enterprise-attack',[Value.x_mitre_platforms] in {"Windows","Linux","macOS"} && CONTAINS('enterprise-attack','enterprise-attack'[url],"https://attack.mitre.org/techniques/"))
)
 
i have attached a screenshot example. Capture.PNG

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors