Forum Discussion
Help, Stuck with Text Column (How to display decimal as a percentage?)
- 9 months ago
Hi gordgord1
Download example PBIX file with the code below
Do you need to keep the N/A ?
Wouldn't getting rid of text and making the column numeric be more useful for further analysis and calculation?
Use this to create the column
Column = SWITCH( TRUE(), [ColumnA (Text)] = "N/A", BLANK(), [ColumnA (Text)] = "", BLANK(), VALUE([ColumnA (Text)] ))Then format the column as Percentage
Or if you want a measure
Measure = VAR _value = SELECTEDVALUE(Data[ColumnA (Text)]) RETURN SWITCH( TRUE(), _value = "N/A", BLANK(), _value = "", BLANK(), VALUE(_value) )Format the measure as a Percentage.
If you want to keep the column as text then use this
Column 2 = SWITCH( TRUE(), IFERROR(VALUE([ColumnA (Text)]), TRUE()), [ColumnA (Text)], FORMAT(VALUE([ColumnA (Text)]), "0.00%") )Regards
Phil
Hi gordgord1
Download example PBIX file with the code below
Do you need to keep the N/A ?
Wouldn't getting rid of text and making the column numeric be more useful for further analysis and calculation?
Use this to create the column
Column =
SWITCH( TRUE(),
[ColumnA (Text)] = "N/A", BLANK(),
[ColumnA (Text)] = "", BLANK(),
VALUE([ColumnA (Text)]
))
Then format the column as Percentage
Or if you want a measure
Measure =
VAR _value = SELECTEDVALUE(Data[ColumnA (Text)])
RETURN
SWITCH( TRUE(),
_value = "N/A", BLANK(),
_value = "", BLANK(),
VALUE(_value)
)
Format the measure as a Percentage.
If you want to keep the column as text then use this
Column 2 =
SWITCH( TRUE(),
IFERROR(VALUE([ColumnA (Text)]), TRUE()), [ColumnA (Text)],
FORMAT(VALUE([ColumnA (Text)]), "0.00%")
)
Regards
Phil