Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello:
I am trying to replace a hyphen ("-") with an en dash in an existing column. I know I'd need to use UNICHAR for this. So, I imagine the formula would be something like this:
IF Table Name Column Name contains "-", replace with UNICHAR(8211)
I don't mind creating a new column or measure if that is necessary.
Thank you!
Solved! Go to Solution.
if it is a value in a cell, use substitute
Column = SUBSTITUTE('Table'[Column1],"-",UNICHAR(8211))
if it is the name of a measure, you replace the whole measure name
Proud to be a Super User!
you can use DAX to create a column
Column = SUBSTITUTE("-",'Table'[Column1],UNICHAR(8211))
Proud to be a Super User!
Thank you, @Greg_Deckler and @ryan_mayu . I tried both the REPLACE and SUBSTITUTE functions, and unfortunately when I try to select the appropriate table and column, the specific column does not show up as an option. Note, it is a string variable. I get an error message saying that "a single value for this column cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
@johnwedeles - If you are creating a measure, then you will need to wrap the column reference in an aggregator like MAX, MIN, etc.
Thank you, @Greg_Deckler . I am entering this code but it is not working - is the right placement for the MAX function?
plesae share the sample data and expected output.
Proud to be a Super User!
@ryan_mayu the string I am working with appears as follows:
Ambulatory Care: Emergency Department (ED) Visits: Ages 0-19 Years
This is an example of several (approximately 40) measures that are in the table. What I would like to do is replace the hypen (Ages 0-19 Years) with an en dash, using UNICHAR.
why this is a measure? not a value in a cell? How did you calculate this? you can just paste your sample data here or paste a screenshot
Proud to be a Super User!
if it is a value in a cell, use substitute
Column = SUBSTITUTE('Table'[Column1],"-",UNICHAR(8211))
if it is the name of a measure, you replace the whole measure name
Proud to be a Super User!
To do this in DAX, just use a new calculated column with REPLACE
https://docs.microsoft.com/en-us/dax/replace-function-dax
User | Count |
---|---|
92 | |
85 | |
77 | |
66 | |
62 |
User | Count |
---|---|
110 | |
95 | |
95 | |
64 | |
59 |