Forum Discussion
CONVERT TEXT TO NUMBER
Is there a way to change a text datatype to a number? Having issues with that. Maybe a way to bypass the error message that a text can't be converted to a number. I've tried advanced editor. Please help. Thanks!
11 Replies
- AnonymousNot applicable
This method worked for me:
in the Transform data view, i Duplicated the original column, (under Add Column Menu, select the column, Duplicate Column menu item) , then Transform menu item the new column, make Data Type numeric. Numbers stayed behind as numeric and text items became blanks, which can be filtered out in the report.
- artemusMicrosoft Employee
Can you provide a sample format of the numbers you are trying to parse along with the country code you are running power bi in?
- cuohaneleHelper I
I created a dynamic format for a column in my table to be filtered by a specific slicer. Unfortunately, it is sorting the numbers like they are string. I used the code below:
Sales$ = IF(ISCROSSFILTERED('Parameter'[calculations]),SWITCH( TRUE(),VALUES('Parameter'[calculations]) = "YoY%",SWITCH( TRUE(),ABS([Sales$ YoY%]) < 1, FORMAT([Sales$ YoY%],"0.0%"),ABS([Sales$ YoY%]) >= 1, FORMAT([Sales$ YoY%],"0%"),BLANK()),VALUES('Parameter'[calculations]) = "YoY Gap", CONCATENATE("$", FORMAT([Sales$ YoY Gap],"0,0")),VALUES('Parameter'[calculations]) = "Current Year Actuals", CONCATENATE("$", FORMAT([Sales$ CY],"0,0")),BLANK()), BLANK ())When any of the options in the slicer is picked, it returns this column sorted out of order.So it is sorting something like this:10012200222333It's formating as a text but I want it to format as a numberThanks in advance!- artemusMicrosoft Employee
oh, this is a DAX question.
Just change the data type of the measure to number:
- Ajinkya369Resolver III
Hi cuohanele ,
Can you just share me the sample dataset and the .pbix file so ,that i can figure out the problem and provide you the solution.
Thank You
- AnonymousNot applicable
Try padding the "numbers" with trailing blanks so that all text ha same length.
Think like you would do some sort of right alignment
Ps
If you search the forum can find a post of mine with the code to do that
- AnonymousNot applicable
- AnonymousNot applicable
another way could be this when MS will exstend the feature of list.sort to tablesort.