Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
User | Count |
---|---|
70 | |
70 | |
34 | |
23 | |
22 |
User | Count |
---|---|
96 | |
94 | |
50 | |
42 | |
40 |