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
PhilipTreacy I work with engineers, not data scientists. Stuck with what is being handed to me. Hence, mixed data in a column. For sake of simplicity, backed off desired format. Not worth the effort or complexity. Just used a formula to standardize the data in the text column so decimal places were no longer variable. 🙂
Prefer not to needlessly complex formula.
Closing Request for Help.