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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I'm trying to remove all characters starting from the dash symbol onwards. If possible via DAX. I'm using Direct Query.
Example 1:
Before: 12345-6789
After: 12345
Example 2:
Before: 1A3-12B
After: 1A3
Appreciate your kind assistance.
Best regards,
Mark V.
Solved! Go to Solution.
hi
After = IF(SEARCH("-",[text column],1,0)>=1,LEFT([text column],SEARCH("-",[text column],1,0)-1),[text column])
Hi @markefrody ,
Please try below steps:
1. below is my test table
Table:
2. create a measure with below dax formula
After =
VAR cur_val =
SELECTEDVALUE ( 'Table'[Before] )
VAR cur_index =
FIND ( "-", cur_val,, -1 )
RETURN
LEFT ( cur_val, cur_index - 1 )
3 add a table visual with fields and measure
Please refer the attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for your assistance @Anonymous. Greatly appreciate it.
hi
After = IF(SEARCH("-",[text column],1,0)>=1,LEFT([text column],SEARCH("-",[text column],1,0)-1),[text column])