Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi!
I'm struggling to create a new collumn with wildcard characters, based on certain values in another collumn using the SWITCH function.
The products in the original collumn are grouped between 100-900 (e.g. 112, 320 etc.). I want to group these into smaller categories.
In plain english I want for example: if the ProductGroup starts with 3, i.e. is between 300-399 (data type = text), it needs to be categorised as "Tools". I used wilcard characters in the DAX query, however it doesn't seem to recognise them. A piece of the query is below - what am I doing wrong? Thanks in advance!
ProductCategory=
SWITCH ( TRUE (),
'Storage’[ProductGroup] = "3**", "Tools",
'Storage’[ProductGroup] = "4**", "Service",
'Storage’[ProductGroup] = "5**", "Transport",
"Other" )
Solved! Go to Solution.
Hi all, the solution turned out to be:
IF (LEFT ( Storage[Productgroup) = LEN(1)) = "3", "Tools",
IF (LEFT ( Storage[Productgroup], LEN(1)) = "4", "Service",
IF (LEFT ( Storage[Productgroup], LEN(1)) = "5", "Transport"
Hi all, the solution turned out to be:
IF (LEFT ( Storage[Productgroup) = LEN(1)) = "3", "Tools",
IF (LEFT ( Storage[Productgroup], LEN(1)) = "4", "Service",
IF (LEFT ( Storage[Productgroup], LEN(1)) = "5", "Transport"
@Joachim2108 Wildcards are not supported in DAX afaik, you will have to use either
https://dax.guide/containsstring/
or
If I can't use wildcards, could I combine the SWITCH statement with a LEFT statement?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
6 | |
5 |
User | Count |
---|---|
19 | |
17 | |
12 | |
9 | |
9 |