Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi
I have a column called Gender which has values like M, and F. I want to use Subsitute() to replace M to Male and F to Female. So what I created a New Column and I wrote this dax
Gender_full = subsitute(Table1(Gender), "M", "Male"")
But that only change M to Male, how can I write one Dax function to subsitute both M and F at same time.
Thank you very much.
Solved! Go to Solution.
@lastnn30 You might kick yourself:
Gender Full Column =
SUBSTITUTE(
SUBSTITUTE([Gender],"M","Male"),
"F", "Female"
)
@lastnn30 you can create a mapping table and utilize moving forward
Column =
VAR mapping =
DATATABLE (
"lookup", STRING,
"val", STRING,
{
{ "Male", "M" },
{ "M", "M" },
{ "F", "F" },
{ "Female", "F" }
}
)
RETURN
MAXX (
FILTER ( mapping, [lookup] = CALCULATE ( MAX ( 'Table'[Column1] ) ) ),
[val]
)
@lastnn30 you can create a mapping table and utilize moving forward
Column =
VAR mapping =
DATATABLE (
"lookup", STRING,
"val", STRING,
{
{ "Male", "M" },
{ "M", "M" },
{ "F", "F" },
{ "Female", "F" }
}
)
RETURN
MAXX (
FILTER ( mapping, [lookup] = CALCULATE ( MAX ( 'Table'[Column1] ) ) ),
[val]
)
@lastnn30 You might kick yourself:
Gender Full Column =
SUBSTITUTE(
SUBSTITUTE([Gender],"M","Male"),
"F", "Female"
)
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 |
---|---|
97 | |
96 | |
81 | |
74 | |
66 |
User | Count |
---|---|
129 | |
106 | |
106 | |
86 | |
72 |