Dplex
July 13, 2022, 1:52am
1
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.
Harsh
July 13, 2022, 2:05am
2
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
Dplex
July 13, 2022, 2:13am
3
Harsh, thank you mate. That works great. Cheers.
Harsh
July 13, 2022, 2:14am
4
Hello @Dplex ,
You’re Welcome!!!
I’m glad that I was able to assist you.
Thanks and Warm Regards,
Harsh
Dplex
July 13, 2022, 2:30am
5
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.
Harsh
July 13, 2022, 2:35am
6
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
Dplex
July 13, 2022, 4:59am
7
Thanks again Harsh. I’ve started building my own set of Text files referencing all these measures being created for future use.