Forum Discussion
Using DAX Search to find separate partial values in multiple columns
- 6 years ago
Hi phaering ,
Try this:
Column = SWITCH ( TRUE (), SEARCH ( "Win2008R2", [OS],, -1 ) <> -1 ----------------------"<> -1" is missing in your expression. && SEARCH ( "Enterprise", [OS_Full_Name],, -1 ) <> -1, "Win 2008 R2 Ent", SEARCH ( "Win2008", [OS],, -1 ) <> -1 ----------------------"<> -1" is missing in your expression. && SEARCH ( "Standard", [OS_Full_Name],, -1 ) <> -1, "Win 2008 Std", SEARCH ( "Linux Red Hat Enterprise Server 7.8", [OS],, -1 ) <> -1, "Red Hat 7.8", SEARCH ( "SunOS 5.10", [OS],, -1 ) <> -1, "SunOS 5.10" )BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 6 years ago
Thank you very much! I never thought to include the "<> -1" in both parts. Much appreciated, this worked.
In your SWITCH statement you would want:
SWITCH(TRUE(),
SEARCH("Win2008 RT",[OS],,-1) && SEARCH("Standard",[OS_Full_Name],,-1) <>-1,"Win 2008 RT Std",
SEARCH("Win2008 ",[OS],,-1) && SEARCH("Standard",[OS_Full_Name],,-1) <>-1,"Win 2008 Std"
This is still not working as the "&&" needs to be both and it appears that it is finding either and applying the value incorrectly.
Here is the output I'm getting and you'll see the formula is not working quite right. I've just done a few lines and you'll see it is applying a windows name to the Red Hat OS. These should have been assigned the "(unknown)" value per the SWITCH formula. It is also not applying the value correctly to the different Windows 2008 and Windows 2008R2 versions.
- Icey6 years agoCommunity Support
Hi phaering ,
Try this:
Column = SWITCH ( TRUE (), SEARCH ( "Win2008R2", [OS],, -1 ) <> -1 ----------------------"<> -1" is missing in your expression. && SEARCH ( "Enterprise", [OS_Full_Name],, -1 ) <> -1, "Win 2008 R2 Ent", SEARCH ( "Win2008", [OS],, -1 ) <> -1 ----------------------"<> -1" is missing in your expression. && SEARCH ( "Standard", [OS_Full_Name],, -1 ) <> -1, "Win 2008 Std", SEARCH ( "Linux Red Hat Enterprise Server 7.8", [OS],, -1 ) <> -1, "Red Hat 7.8", SEARCH ( "SunOS 5.10", [OS],, -1 ) <> -1, "SunOS 5.10" )BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- phaering6 years agoHelper I
Thank you very much! I never thought to include the "<> -1" in both parts. Much appreciated, this worked.