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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Lcouch
New Member

DAX Function on FILTER with like?

Hello,

 

Can I create a measure when I filter on a value like I have Servicebus below- use Like %Servicebus% as we do in SQL?

 

The column in the tables has various values with this word and I need all of them returned. I did get an error with typing it as above.

 

 

Total Of ALMM Service Bus Actions =
CALCULATE(COUNTA('VIEW_ALMMTaskRequestDetails'[CreatedBy]), FILTER('VIEW_ALMMTaskRequestDetails', 'VIEW_ALMMTaskRequestDetails'[ResourceType] ="Servicebus"))  --- see above need to get a count of all with this word in it
 
 
 
Thank you!!!
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Lcouch 

The code you displayed is not the same as mine:

Total Of ALMM Service Bus Actions =
COUNTAX(FILTER('VIEW_ALMMTaskRequestDetails', CONTAINSSTRING('VIEW_ALMMTaskRequestDetails'[ResourceType] ,"Servicebus")) ,[CreatedBy])

Maybe you can try the code above again

 

Best Regards!

 

Yolo Zhu

View solution in original post

10 REPLIES 10
Rohit_Patil7399
New Member

evaluate
SUMMARIZECOLUMNS('Contract'[Business Unit],
FILTER('Contract',CONTAINSSTRING('Contract'[Business Unit],"AUS"))) --->>This is equivalent to like condition in SQL.

Anonymous
Not applicable

Hi @Lcouch 

 

You can try the following code:

 

 

Total Of ALMM Service Bus Actions =
COUNTAX(FILTER('VIEW_ALMMTaskRequestDetails', CONTAINSSTRING('VIEW_ALMMTaskRequestDetails'[ResourceType] ,"Servicebus")) ,[CreatedBy])

 

 

Best Regards,

Yolo Zhu

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

@Anonymous 

When I tried

Total Of ALMM Service Bus Actions = COUNTAX(FILTER('VIEW_ALMMTaskRequestDetails', 'VIEW_ALMMTaskRequestDetails'[ResourceType] ="Servicebus") ,[CreatedBy])

I get the same result as when I use 

 

Total Service Bus Provisions =

CALCULATE(COUNTA('VIEW_SBFuncAppWebAppEventHubs'[Name]), FILTER('VIEW_SBFuncAppWebAppEventHubs', 'VIEW_SBFuncAppWebAppEventHubs'[Type]="ServiceBus") )

 

 

it gives me the count.. but for any types that have 'ServiceBus' as part of the name but it is not the only spelling.. it doesnt return them

Anonymous
Not applicable

Hi @Lcouch 

The code you displayed is not the same as mine:

Total Of ALMM Service Bus Actions =
COUNTAX(FILTER('VIEW_ALMMTaskRequestDetails', CONTAINSSTRING('VIEW_ALMMTaskRequestDetails'[ResourceType] ,"Servicebus")) ,[CreatedBy])

Maybe you can try the code above again

 

Best Regards!

 

Yolo Zhu

Manoj_Nair
Solution Supplier
Solution Supplier

@Lcouch - Try this calculated column DAX as below shown.

Manoj_Nair_0-1670029317599.png

 

@Lcouch 

Oops!! I missed copying the DAX. Let me know if this fixes your problem

 

Total Of ALMM Service Bus Actions = 
IF (
    SEARCH (
        "Servicebus",
        VIEW_ALMMTaskRequestDetails[ResourceType],
        1,
        0
    ) > 0,
    "Servicebus",
    BLANK ()
)

 

 

Hi!

 

Thank you @Manoj_Nair  but it doesnt count CreatedBy

 

So my current function is

 

Total Of ALMM Service Bus Actions =

CALCULATE(COUNTA('VIEW_ALMMTaskRequestDetails'[CreatedBy]), FILTER('VIEW_ALMMTaskRequestDetails', 'VIEW_ALMMTaskRequestDetails'[ResourceType] ="Servicebus"))

 

and the one you provide is below but no count of createdy by

Total Of ALMM Service Bus Actions = IF ( SEARCH ( "Servicebus", VIEW_ALMMTaskRequestDetails[ResourceType], 1, 0 ) > 0, "Servicebus", BLANK () )  

Greg_Deckler
Super User
Super User

@Lcouch You can use CONTAINSSTRING. Doesn't do the % wildcards but otherwise might work. CONTAINSSTRING function (DAX) - DAX | Microsoft Learn



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler - 

 

I get an error when I tried:

 

Total Of ALMM Service Bus Actions =

 

CALCULATE(COUNTA('VIEW_ALMMTaskRequestDetails'[CreatedBy]), FILTER('VIEW_ALMMTaskRequestDetails', ('VIEW_ALMMTaskRequestDetails'[ResourceType] CONTAINSSTRING("Servicebus"))

 

Also tried:

Total Of ALMM Service Bus Actions =

CALCULATE(COUNTA('VIEW_ALMMTaskRequestDetails'[CreatedBy]), EVAULATE ROW('VIEW_ALMMTaskRequestDetails', ('VIEW_ALMMTaskRequestDetails'[ResourceType] CONTAINSSTRING("Servicebus"))

 

(removed the filter even though I need that filter) but it didnt like Evaluate

@Lcouch

CONTAINSSTRING takes 2 parameters:

CONTAINSSTRING(<within_text>, <find_text>)

So try:

CALCULATE(COUNTA('VIEW_ALMMTaskRequestDetails'[CreatedBy]), CONTAINSSTRING('VIEW_ALMMTaskRequestDetails'[ResourceType], "Servicebus"))



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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