Forum Discussion
Power Query formula to get text after last comma - BI Service
- 1 year ago
Hi MikeGanem3 , Thank you for reaching out to the Microsoft Community Forum.
In Power BI Service, you can't modify datasets directly like you do in Power BI Desktop using Power Query, However, you can achieve this using DAX in a calculated column or measure.
- Example for Column:
NewColumn =
VAR TextList = 'YourTable'[YourColumn] -- Replace with your actual table and column name
VAR LastValue = TRIM(RIGHT(TextList, LEN(TextList) - FIND("@", SUBSTITUTE(TextList, ", ", "@", LEN(TextList) - LEN(SUBSTITUTE(TextList, ", ", ""))))))
RETURN LastValue
- Example for Measure:
LastValueMeasure =
VAR TextList = SELECTEDVALUE('YourTable'[YourColumn])
VAR LastValue = TRIM(RIGHT(TextList, LEN(TextList) - FIND("@", SUBSTITUTE(TextList, ", ", "@", LEN(TextList) - LEN(SUBSTITUTE(TextList, ", ", ""))))))
RETURN LastValue
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
- MikeGanem31 year ago
Helper I
I know how to do it in Desktop and already mentioned in my original post, my question was how to do it in BI Service
- v-hashadapu1 year ago
Community Support
Hi MikeGanem3 , Thank you for reaching out to the Microsoft Community Forum.
In Power BI Service, you can't modify datasets directly like you do in Power BI Desktop using Power Query, However, you can achieve this using DAX in a calculated column or measure.
- Example for Column:
NewColumn =
VAR TextList = 'YourTable'[YourColumn] -- Replace with your actual table and column name
VAR LastValue = TRIM(RIGHT(TextList, LEN(TextList) - FIND("@", SUBSTITUTE(TextList, ", ", "@", LEN(TextList) - LEN(SUBSTITUTE(TextList, ", ", ""))))))
RETURN LastValue
- Example for Measure:
LastValueMeasure =
VAR TextList = SELECTEDVALUE('YourTable'[YourColumn])
VAR LastValue = TRIM(RIGHT(TextList, LEN(TextList) - FIND("@", SUBSTITUTE(TextList, ", ", "@", LEN(TextList) - LEN(SUBSTITUTE(TextList, ", ", ""))))))
RETURN LastValue
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.