- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
value based on specific characters
Hi all,
I'm looking for a DAX query that will fill in the column 'Outcome' as follow:
If Type is "Sensor 1" AND Space Contains "A", OR " B" OR "C" then NAME A
If Type is "Sensor 1" AND Space does not Contains "A", OR " B" OR "C" then NAME B
If Type is "Sensor 2" AND Space does Contains "A", OR " B" then NAME C
If Type is "Sensor 2" AND Space does not Contains "A", OR " B" then NAME D
If Type is "Sensor 2" AND Space is emtpy then NAME E
Type | Space | Outcome |
sensor 1 | 12A | Name A |
sensor 1 | 12B | Name A |
sensor 1 | 12 | Name B |
Sensor 2 | 13C | Name C |
Sensor 2 | 13 | Name D |
Sensor 2 | Name E |
I was not able to achive this, hopefully anybody can help me out! Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, @joep78
Please check the below.
it is for creating a new column.
Outcome CC =
SWITCH (
TRUE (),
'Table'[Type] = "sensor 1"
&& OR (
CONTAINSSTRING ( 'Table'[Space], "A" ),
CONTAINSSTRING ( 'Table'[Space], "B" )
), "NAME A",
'Table'[Type] = "Sensor 1"
&& NOT CONTAINSSTRING ( 'Table'[Space], "A" )
&& NOT CONTAINSSTRING ( 'Table'[Space], "B" )
&& NOT CONTAINSSTRING ( 'Table'[Space], "C" ), "NAME B",
'Table'[Type] = "Sensor 2"
&& OR (
CONTAINSSTRING ( 'Table'[Space], "A" ),
OR (
CONTAINSSTRING ( 'Table'[Space], "C" ),
CONTAINSSTRING ( 'Table'[Space], "B" )
)
), "NAME C",
'Table'[Type] = "Sensor 2"
&& NOT CONTAINSSTRING ( 'Table'[Space], "A" )
&& NOT CONTAINSSTRING ( 'Table'[Space], "B" )
&& 'Table'[Space] <> BLANK (), "NAME D",
'Table'[Type] = "Sensor 2"
&& 'Table'[Space] = BLANK (), "Name E"
)
https://www.dropbox.com/s/qkx7v34mo53yabf/joep.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, @joep78
Please check the below.
it is for creating a new column.
Outcome CC =
SWITCH (
TRUE (),
'Table'[Type] = "sensor 1"
&& OR (
CONTAINSSTRING ( 'Table'[Space], "A" ),
CONTAINSSTRING ( 'Table'[Space], "B" )
), "NAME A",
'Table'[Type] = "Sensor 1"
&& NOT CONTAINSSTRING ( 'Table'[Space], "A" )
&& NOT CONTAINSSTRING ( 'Table'[Space], "B" )
&& NOT CONTAINSSTRING ( 'Table'[Space], "C" ), "NAME B",
'Table'[Type] = "Sensor 2"
&& OR (
CONTAINSSTRING ( 'Table'[Space], "A" ),
OR (
CONTAINSSTRING ( 'Table'[Space], "C" ),
CONTAINSSTRING ( 'Table'[Space], "B" )
)
), "NAME C",
'Table'[Type] = "Sensor 2"
&& NOT CONTAINSSTRING ( 'Table'[Space], "A" )
&& NOT CONTAINSSTRING ( 'Table'[Space], "B" )
&& 'Table'[Space] <> BLANK (), "NAME D",
'Table'[Type] = "Sensor 2"
&& 'Table'[Space] = BLANK (), "Name E"
)
https://www.dropbox.com/s/qkx7v34mo53yabf/joep.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jihwan Kim,
Thanks for this, really helpful!
Regards, Joep
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - January 2025
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
Subject | Author | Posted | |
---|---|---|---|
07-30-2024 11:51 AM | |||
06-25-2024 12:12 AM | |||
06-27-2024 01:22 PM | |||
03-06-2024 03:48 AM | |||
05-09-2024 11:16 AM |
User | Count |
---|---|
115 | |
75 | |
45 | |
44 | |
32 |
User | Count |
---|---|
172 | |
90 | |
66 | |
46 | |
45 |