Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi Experts,
I am novice to power bi and struggling with query in sql to convert in dax query.
For example :
IH06.TPLNR_FUNCTIONALLOC NOT LIKE '16__9___'
How to convert query in dax query?
Solved! Go to Solution.
Hi @vividarinda ,
You can create a calculated column as below to get it:
Category =
SWITCH(
TRUE(),
LEFT([UnitNo], 2) = "77", "KBL",
LEFT([UnitNo], 2) = "16" && MID([UnitNo], 5, 1) = "9", "Rental",
"PETROSEA"
)
Best Regards
Hi @vividarinda ,
I created a sample pbix file(see the attachment), please check if that is what you want.
Table 2 = FILTER('Table',IFERROR(SEARCH("16__9___",'Table'[TPLNR_FUNCTIONALLOC],1,0),0)=0)
Best Regards
Hi @Anonymous ,
Thanks your feedback, i mean, can i filter with escape underscore in dax query?
IH06.TPLNR_FUNCTIONALLOC NOT LIKE '16__9___'
@vividarinda
DAX has a function called CONTAINSSTRING, it should work for you.
Example:Countries ending with "land"
Evaluate
FILTER ( ALL ( Customer[CountryRegion] ), CONTAINSSTRING ( Customer[CountryRegion], "*land" ) )
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi @Fowmy ,
Thanks your feedback, i mean, can i filter with escape underscore in dax query?
IH06.TPLNR_FUNCTIONALLOC NOT LIKE '16__9___'
Hi @vividarinda ,
Could you please provide some raw data and samples to explain your requirement?
filter with escape underscore in dax query?
IH06.TPLNR_FUNCTIONALLOC NOT LIKE '16__9___'
Best Regards
I have a raw data like this,
| UnitNo | Category |
| 77DZ0279 | KBL |
| 77DZ0249 | KBL |
| 77GD9006 | KBL |
| 77GD0062 | KBL |
| 16DZ0277 | PETROSEA |
| 16EX0154 | PETROSEA |
| 16EX9011 | Rental |
| 16DZ9178 | Rental |
then i want filter based on condition like this :
- If UnitNo start with 77, then "KBL",
- If UnitNo start with 16__9___, then "Rental",
- If else "Petrosea"
Hi @vividarinda ,
You can create a calculated column as below to get it:
Category =
SWITCH(
TRUE(),
LEFT([UnitNo], 2) = "77", "KBL",
LEFT([UnitNo], 2) = "16" && MID([UnitNo], 5, 1) = "9", "Rental",
"PETROSEA"
)
Best Regards
Thank you very much for your help very helpful
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 63 | |
| 55 | |
| 42 | |
| 41 | |
| 23 |
| User | Count |
|---|---|
| 171 | |
| 136 | |
| 119 | |
| 79 | |
| 54 |