Can I Filter a Word In A Description

Hi, I’m calculating a sales column filtering for a single word within the description of another column. Am I amble to do this? My current formula isn’t showing any result. My DAX is:

Crate % = DIVIDE
(CALCULATE (SUM (Sales[ Delivered]), Deliveries[ Description]=“CRATE”),
SUM (Sales[ Delivered])))

The Deliveries Description though may read: “Blue Beer Long Bottle CRATE”.
I wish to filter based on descriptions that contain only the word “Crate”.

Just wondering where my syntax might be incorrect.

Thanks.

Hello @Dplex,

Thank You for posting your query onto the Forum.

Can you please try the below provided measure to achieve the results?

Crate % = 
DIVIDE(
    CALCULATE( SUM( Sales[ Delivered] ) , 
        FILTER( Deliveries ,
            CONTAINSSTRING( Deliveries[ Description] , "CRATE" ) ) ) ,
    SUM( Sales[ Delivered] ) )

Hoping you find this useful and meets your requirements that you’ve been looking for.

Thanks and Warm Regards,
Harsh

Harsh, thank you mate. That works great. Cheers.

Hello @Dplex,

You’re Welcome!!! :slightly_smiling_face:

I’m glad that I was able to assist you.

Thanks and Warm Regards,
Harsh

Sorry Harsh, I just discovered many of the descriptions contain either CRT or CRATE. How would I manage the syntax with an OR Statement to account for either name?

Thanks.

Try this -

Crate % = 
DIVIDE(
    CALCULATE( SUM( Sales[ Delivered] ) , 
        FILTER( Deliveries ,
            CONTAINSSTRING( Deliveries[ Description] , "CRATE" ) ||
            CONTAINSSTRING( Deliveries[ Description] , "CRT" ) ) ) ,
    SUM( Sales[ Delivered] ) )

Thanks and Warm Regards,
Harsh

Thanks again Harsh. I’ve started building my own set of Text files referencing all these measures being created for future use.