Forum Discussion
Anonymous
6 years agoNot applicable
Using DAX Wild Cards
Hi
I've been experimenting with DAX wild cards but not getting the results I expected.
Here's a sample of the data I'm using:
CALCULATEI wondered whether I could, in CALCULATE statements, use just part of the "Product" text by using wildcards. I've created the following Measures:
C1 Sales = CALCULATE([Total Sales £],Sales[Product]="C*") (**I expected this to select rows with"Carrot")
Pot Sales = CALCULATE([Total Sales £],FILTER(Sales,Sales[Product]="Pot*")) (**I expected this to select rows with"Potato")
ThirdLetterO Sales = CALCULATE([Total Sales £],Sales[Product]="??o*") (**I expected this to select rows with"Whole Wheat")
, but I can't get these to work, for example:
These 2 work fine - no wildcards:
Carrot Sales = CALCULATE([Total Sales £],Sales[Product]="Carrot")
Potato Sales = CALCULATE([Total Sales £],Left(Sales[Product],3)="Pot")
So - what's wrong with my attempts at using wildcards in CALCULATE, with or without FILTER?
Thanks!
2 Replies
- AnonymousNot applicable
- sturlawsResident Rockstar
Hi, here are some possible strategies for solving your problem:
https://www.sqlbi.com/articles/from-sql-to-dax-string-comparison/