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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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