Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
HI,
I am having an use case where I need to use SUBSTITUTE function. SUBSTITUTE should have dynamic occurance - which means, someties it changes 1st occurance , sometimes 2nd etc.
Summarizing the problem:
Solved! Go to Solution.
I think you're just not handling the case when there are no occurrences. This works for me:
Where
Last Occurance =
VAR _text = SELECTEDVALUE ( 'table'[Text] )
VAR _ToPath = SUBSTITUTE ( _text, "X", "|" )
VAR _Result = PATHLENGTH ( _ToPath ) - 1
RETURN
_Result
@AlexisOlson Awesome solution. Thanks for that!
I think you're just not handling the case when there are no occurrences. This works for me:
Where
Last Occurance =
VAR _text = SELECTEDVALUE ( 'table'[Text] )
VAR _ToPath = SUBSTITUTE ( _text, "X", "|" )
VAR _Result = PATHLENGTH ( _ToPath ) - 1
RETURN
_Result
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
81 | |
79 | |
67 |
User | Count |
---|---|
122 | |
110 | |
94 | |
82 | |
77 |