Forum Discussion
Arman_And
3 years agoRegular Visitor
Split column based on another column
Hi Everyone
I want to split one column based on another column. In other words, I want to subtract the string of another column from the current column.
I'm looking for a DAX or PQ formula to reach to Result column by splitting the Name column based on Subcategory Column.
Please check the sample dataset below:
The current stat:
| Subcategory | Name |
| Courts | SCHOOL PARK COURT |
| Playgrounds | MEMORIAL ELEMENTARY PLAYGROUNDS |
The Result:
| Subcategory | Name | Result |
| Courts | SCHOOL PARK COURT | SCHOOL PARK |
| Playgrounds | MEMORIAL ELEMENTARY PLAYGROUNDS | MEMORIAL ELEMENTARY |
Hi Arman_And ,
You could try this:-
Column = VAR _found = FIND ( UPPER ( 'Table'[Subcategory] ), UPPER ( 'Table'[Name] ), 1, 0 ) RETURN TRIM ( REPLACE ( UPPER ( 'Table'[Name] ), _found, LEN ( 'Table'[Subcategory] ), "" ) )Output;-
2 Replies
- Samarth_18Community Champion
Hi Arman_And ,
You could try this:-
Column = VAR _found = FIND ( UPPER ( 'Table'[Subcategory] ), UPPER ( 'Table'[Name] ), 1, 0 ) RETURN TRIM ( REPLACE ( UPPER ( 'Table'[Name] ), _found, LEN ( 'Table'[Subcategory] ), "" ) )Output;-
- Arman_AndRegular Visitor
Samarth_18 Thanks a lot.