Forum Discussion
undefined
i need output as text without the bracket ex : Head Office
I used to write the code
Right ( dim( customer) , search("(" , dim( customer) 1, len ( dim( customer )+1)-1)
My output is (Head Office)
I need without bracket in dax query
20 Replies
- rubayatyasminCommunity Champion
Hi, Karthikgayathri
Go to power query and use Split by Delimiter. Set the delimiter to (, it will split it in a new column. Rename the column. this kind of changes fall under data transformation. No need to write DAX for it. Power Query has it's own functionality to handle these sort of stuff.
Refer to this document : https://learn.microsoft.com/en-us/power-query/split-columns-delimiter
- KarthikgayathriHelper I
Bro I need dax formula by using left ,right ,mid functions
- rubayatyasminCommunity Champion
Use MID func.
=MID([ColumnName], FIND("(", [ColumnName], 1, LEN([ColumnName]), 0) + 1,
FIND(")", [ColumnName], 1, LEN([ColumnName]), 0) - FIND("(", [ColumnName], 1, LEN([ColumnName]), 0) - 1)replace col name with actual column name .
- KarthikgayathriHelper I
Instead of 0 only u used len function then again using 0 how u used 0 ?
- rubayatyasminCommunity Champion
Here is the explanation of the formula:
- FIND("(", [ColumnName], 1, LEN([ColumnName]), 0) + 1 - It finds the first character after the opening bracket.
- FIND(")", [ColumnName], 1, LEN([ColumnName]), 0) - FIND("(", [ColumnName], 1, LEN([ColumnName]), 0) - 1 - It calculates the number of characters to extract.
- MID([ColumnName], ..., ...) - This function will then extract the required number of characters starting from the specified position.
Also, know the details of the Find function.
refer: https://learn.microsoft.com/en-us/dax/find-function-dax
- tamerj1Community Champion
Hi Karthikgayathri
Please tryBill to Customer 2 = SUBSTITUTE ( SUBSTITUTE ( dimCustomer[Bill to Customer], ")", "" ), "(", "" )- KarthikgayathriHelper I
for your query above image
output . I need only head office without bracket
- tamerj1Community Champion
Karthikgayathri
Sorry. I misunderstood the requirement. Please tryBill to Customer 2 = VAR String = dimCustomer[Bill to Customer] VAR Items = SUBSTITUTE ( SUBSTITUTE ( String, "(", "|" ), ")", "|" ) RETURN PATHITEM ( Items, 2 )